PCA
PCA

Reputation: 1707

Jqgrid row selected on clicking on disabled prev and next pager

I'm using jqgrid, where i face an odd problem

I have some ten records in the grid, so i have the pager NEXT and PREVIOUS button disabled. Now on clicking on the disabled NEXT and PREVIOUS buttons and after click on the records one by one, after each time clicking on the next and previous button, multiple rows in the gird are getting selected, Which should not happen

How to avoid this behaviour, Does any one already resolved this issues

Please let me know it.

Upvotes: 1

Views: 1329

Answers (2)

Oleg
Oleg

Reputation: 221997

You are right! It'a a bug in jqGrid. Disabled buttons can be clicked at least in IE browser. Later processing of such click in jqGrid follow setting of selrow to null. If the next row will be selected, after previous clicking on disabled pager button, jqGrid removes ui-state-highlight class only from the line having id selrow. Because the parameter selrow have now null value one will have more as one selected rows in case of usage default multiselect: false option.

One can fix the bug by adding the line

if ($(this).hasClass("ui-state-disabled")) { return false; }

as the first line of the click event handler registered on pager buttons (after the line which has the number 2107 in jquery.jqGrid.src.js of version 4.5.4).

I posted here the corresponding bug report to trirand.

Upvotes: 1

Soony
Soony

Reputation: 923

If you just need an always-single-selected grid. This may help:

    beforeSelectRow: function(id){
        $('#grid tr.ui-state-highlight').removeClass('ui-state-highlight');
        $('#grid tr#' + id).addClass('ui-state-highlight'); 
    },

Upvotes: 1

Related Questions