tags:

views:

70

answers:

1

Hello friends, I need to get the row count before grid loads.. Based on Row count I need to make some validation to the button. using jquery..

Here is my code using to get the jquery grid row count

var rowCount = $("#Grid").jqGrid('getGridParam', 'records');
                if (rowCount < 100) {
                    $('#btnAll').attr('disabled', 'disabled');
                }
                else {
                      $('#btncancel').attr('disabled', 'disabled');
                }

but roCount I am allways getting 0.. this count is getting before grid load.. Here is the Grid Event which is binding.

var RegisterGridEvents = function(excGrid) {
        //Register column chooser
        $(excGrid).jqGrid('navButtonAdd', excGrid + '_pager',
             { caption: "Columns",
                 title: "Reorder Columns",
                 onClickButton: function() {
                     $(excGrid).jqGrid('columnChooser');
                 }
             });
+1  A: 

You can't get the row count before data is fetched. Think about it.

Instead you handle the gridComplete event and disable/enable your button the instant that the data is returned.

Craig Stuntz
gridComplete is not working and i tried loadComplete too?thanks
kumar
`gridComplete` is the correct place to do this. c.f. the pager source code. If it's still not working, you need to show more code.
Craig Stuntz