Question

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.

Was it helpful?

Solution 2

For columns count:

nbCols = grid.columns.length;

For rows count :

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

OTHER TIPS

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:

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top