datagrid 里的width:816 能不能设置100%,如果加一个fix:true的属性,datagrid 的表格会变形。如果是设置成像素,当收缩时,会出现附件里的样子。 datagrid 表格里的表格只有设置设置的width大小。加入了fix:true后,收缩时也会出现附件里的情况,不知道是怎么回事。。。
[code="javascript"]
$('#authListTableId').datagrid({ title:'权限列表', iconCls:'icon-save', [color=red]width:816,[/color] height:470, nowrap: false, striped: true, url:'../jsontree/authdata', pageList:[10,15,20,30,40,50], remoteSort: false, idField:'authId', fix:false, frozenColumns:[[ ]], columns:[[ {field:'ck',checkbox:true} , {title:'权限ID',field:'authId',width:50,align:'center',sortable:true}, {title:'权限父ID',field:'authPid',width:50,align:'center',sortable:true}, {title:'权限名称',field:'authName',width:150,sortable:true}, {title:'权限别名',field:'aliasName',width:150 ,sortable:true}, {title:'权限URL',field:'authURL',width:150,sortable:true}, {title:'权限提示信息',field:'tips',width:150,sortable:true}, {title:'打开目标',field:'target',width:150,sortable:true}, {title:'ICON图标',field:'icon',sortable:true}, {title:'打开时ICON',field:'iconOpen',sortable:true}, {title:'关闭时ICON',field:'iconClose',sortable:true}, {title:'权限级别',field:'authLevel',width:50,align:'center',sortable:true}, {title:'权限排序',field:'sortNo',width:50,align:'center',sortable:true}, {title:'是否叶子',field:'isLeaf',align:'center',sortable:true} ]], pagination:true, rownumbers:false, toolbar:[{ id:'btnadd', text:'添加', iconCls:'icon-add', handler:function(){ $('#btnsave').linkbutton('enable'); //以下为添加的操作 // $('#addAuthopenWindowId').window("open"); window.open("../index/saveAuth2.jsp?nodeId=","","height=" + 400 + ",width=" + 600 + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no"); //以上为添加的操作 } },'-',{ id:'btndelete', text:'删除', iconCls:'icon-cancel', handler:function(){ $('#btndelete').linkbutton('enable'); //--- var idsstr =""; var ids = new Array(); var rows = $('#authListTableId').datagrid('getSelections'); if(rows.length<1){ $.messager.alert('信息窗口','请选择要删除的数据!','info'); }else{ var cand = true; for(var i=0;i<rows.length;i++){ ids.push(rows[i].authId); idsstr += "ids="+rows[i].authId+"&"; if(rows[i].authId == 0){ cand= false; break; } } if(cand){ $.messager.confirm('删除窗口', '注意:删除时会连同其子菜单也一起删除,你确定要删除吗?', function(r){ if (r){ //--s-执行删除操作 idsstr = idsstr.substring(0,(idsstr.length-1)); $.ajax({ type: "POST", url: "../jsontree/deleteauth.action"+"?"+idsstr, data:null, dataType:"json", cache:false, success: function(msg){ if(msg.result){ var treeInfo = document.getElementById("treeInfoId").value; if(!(treeInfo == ""||treeInfo==null)){ var info = treeInfo.split(","); var tab = getSelTab(info[1]); parent.frames["leftFrame"].location.href ="../base/treesfrm!getTreeByNodeId.action?nodeId="+info[4]; if(tab){ closeTab(info[1]); var title = info[1]; title = title.substring(2); createTab(title,info[0],info[2],info[3],info[4]); } } $.messager.alert('信息窗口','删除成功!','info'); }else{ $.messager.alert('信息窗口','删除失败!','info'); } } }); //--e-执行删除操作 } }) }else{ $.messager.alert('信息窗口','你选择的数据中有ID为0的数据,此数据为系统数据,不能删除!','info'); } } //--- } },'-',{ id:'btnupdate', text:'修改', iconCls:'icon-edit2', handler:function(){ $('#btnupdate').linkbutton('enable'); //--- var rows = $('#authListTableId').datagrid('getSelections'); if(rows.length==1){ var authid = rows[0].authId; if(authid != 0){ window.open("../base/authupdate!toUpdatePage.action?nodeId="+authid,"","height=" + 400 + ",width=" + 600 + ",toolbar=no,menubar=no,scrollbars=no,resizable=no,status=no"); }else{ $.messager.alert('信息窗口','此节点数据不能修改!','info'); } }else if(rows.length < 1){ $.messager.alert('信息窗口','请选择要修改的数据!','info'); }else{ $.messager.alert('信息窗口','每次只能修改一条数据!','info'); } //--- } } //------------- ,'-',{ id:'btnquery', text:'查询', iconCls:'icon-search', handler:function(){ $('#btnquery').linkbutton('enable'); alert('查询') } } //------------- //------------- ,'-',{ id:'btntest', text:'测试', iconCls:'icon-ok', handler:function(){ $('#btntest').linkbutton('enable'); alert("测试"); } } //------------- ] });[/code]