首页 > 代码库 > Extjs Ext.grid.column.Column 自适应内容
Extjs Ext.grid.column.Column 自适应内容
var griddb = Ext.ComponentQuery.query("Ali_DeliveryAuthorityList");
griddb = griddb[griddb.length - 1];
var store = Ext.getStore("DeliveryAuthorityStore");
store.proxy.extraParams = obj;
store.loadPage(1
, {
scope: this,
callback: function (records, operation, success) {
//有两种办法
//第一种
var grid = griddb;
var columns = grid.columns;
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
grid.getView().autoSizeColumn(column);
column.setWidth(column.getWidth() + 5);
};
////--第二种Begin-自动适应列宽
var upList = griddb;
for (var i = 1; i < upList.headerCt.getColumnCount() ; i++) {
upList.headerCt.getGridColumns()[i].autoSize(i);
upList.headerCt.getGridColumns()[i].setWidth(upList.headerCt.getGridColumns()[i].getWidth() + 5);
};
////--End-自动适应列宽
loadMarsk.hide();
}
}
);
Extjs Ext.grid.column.Column 自适应内容