1. 程式人生 > >Extjs Ext.grid.column.Column 自適應內容

Extjs Ext.grid.column.Column 自適應內容

style 適應列寬 head var lis ext.get -- osi begin

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 自適應內容