0

When I change the rowNum in paging combobox (see below) enter image description here

I want to find out which number was selected so I have decided to use the next approach:

onPaging : function(pgButton) {
  onPagingHandler(pgButton);
}

...

function onPagingHandler(pgButton) {
  if (pgButton != "records"){
    return;
  }
  alert($("#gridId").getGridParam('rowNum'));
}

The issue is when I got say 10 selected in the combobox and now I am selecting say 30, inside the event handler this code $("#gridId").getGridParam('rowNum') still give me previous value (which is 10). Why doesn't it give me 30 and how can I fix it?

Anton Kasianchuk
  • 1,177
  • 5
  • 13
  • 31

1 Answers1

1

You have to get the value directly from the select:

onPaging : function(pgButton) {
    if (pgButton != "records"){
        return;
    }

    var newRowNum = $(".ui-pg-selbox", this.p.pager).val();
}
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • this.p.pager didn't work for me so I had to use only this.p and it worked good for me – Anton Kasianchuk Oct 14 '14 at 06:57
  • 1
    @AntonKasyanchuk: Probably you used `this.p.pager` inside of `onPagingHandler` instead of direct usage it in `onPaging`. The code `onPaging: function (pgButton) { onPagingHandler(pgButton); }` don't forward `this` initialized to DOM of grid `$("#gridId")[0]`. You should either use `onPaging: onPagingHandler` or `onPaging: function (pgButton) { onPagingHandler.call(this, pgButton); }` – Oleg Oct 14 '14 at 08:09