var pageRight_store = Ext.create('Ext.data.Store', {
//model: 'pageRight',
fields: [
{
name : 'roleName'
}, {
name : 'roleRights'
},{
name:'roleUser'
}
],
pageSize:200,//不加,点击下一页时默认25条
proxy: {
type: 'ajax',
actionMethods: {
read : 'POST', // by default GET
},
url: 'role!pageRight.action',
reader: {
// type: 'json',
root: 'result',
totalProperty : 'totalCount'
}
},
//autoLoad: true
});
var pageRight_grid = Ext.create('Ext.grid.Panel', {
//autoHeight:true,
//height: document.documentElement.clientHeight,
//autoWidth:true,
loadMask : true,
stripeRows : true,
frame : true,
store : pageRight_store,
width:1000,
// layout:"fit",
//bodyStyle:'width:100%',
viewConfig : {
//forceFit : true
enableTextSelection:true //可复制内容
},
columns : [ {
header : '角色名称',
//width:150,
flex:1,//随着grid变化,设置列宽自适应(pageRight_grid.headerCt.getGridColumns()[0].autoSize())后,此属性不起作用
dataIndex : 'roleName'
}, {
header : '角色权限',
width : 400,
//height: 100,
//autoHeight:true,
dataIndex : 'roleRights',
renderer : function (value, meta, record) {//内容超长自动换行/高度自适应
meta.style = 'white-space:normal;word-break:break-all;';
return value;
}
}, {
header : '人员',
//width : 400,
flex:1,
dataIndex : 'roleUser'
}]
});
var pageRight_win =Ext.create('Ext.Window', {
closeAction : 'hide',
title:"权限详情",
modal : true,
//autoHeight : true,
//autoWidth:true,
layout:"fit",//自适应grid
items : pageRight_grid
});
pageRight_store.load({
callback : function (records, options, success) {
//alert("123")
if (success){
//列宽自适应
pageRight_grid.headerCt.getGridColumns()[0].autoSize();
// pageRight_grid.headerCt.getGridColumns()[1].autoSize();
pageRight_grid.headerCt.getGridColumns()[2].autoSize();
}
}
});
pageRight_win.show();