javascriptextjsgridpanel

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')

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.


Solution

  • For columns count:

    nbCols = grid.columns.length;
    

    For rows count :

    nbRows = grid.getStore().getTotalCount();