[英]how to count gridpanel number column extjs
I am trying make a validation with number of column condition. 我正在尝试使用列条件数进行验证。
Here the code I tried and return (Object [object Object] has no method 'getColumnCount')
这是我尝试
return (Object [object Object] has no method 'getColumnCount')
的代码return (Object [object Object] has no method 'getColumnCount')
var grid = Ext.getCmp('frm_request_form_gridpanel');
//var recordCount = GridPanel().getStore().getCount();
var count = grid.getStore().getColumnCount(true);
//output
success: function() {
Ext.MessageBox.show({
title: 'Informasi',
msg: 'Transaksi berhasil.' + count,
buttons: Ext.MessageBox.OK,
fn: function() {
myRequest.close();
},
animateTarget: 'p_content',
icon: Ext.MessageBox.INFO
});
}
Please give me solution. 请给我解决方法。
To get count of hidden as well as visible columns use: 要获取隐藏列和可见列的计数,请使用:
var columnCount = grid.getColumnModel().getColumnCount(false);
To get count of only visible columns use: 要获取仅可见列的计数,请使用:
var columnCount = grid.getColumnModel().getColumnCount(true);
Add this code to gridpanel config: 将此代码添加到gridpanel配置中:
listeners: {
afterrender: function (this) {
App.gridColumnsCount = this.initialConfig.columns.items.length;
//alert(this.initialConfig.columns.items.length);
}
}
you can use 您可以使用
var count = grid.getStore().getTotalCount();
It retreives the total number of records in the store that is accessed by the grid. 它检索网格中存储的存储中的记录总数。
For columns count: 对于列数:
nbCols = grid.columns.length;
For rows count : 对于行数:
nbRows = grid.getStore().getTotalCount();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.