extjs4 列宽自适应,列高自适应(换行),grid内容自适应,window窗体自适应grid,相互之间有冲突


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();
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值