Author Topic: How to Select the rows of the current page?  (Read 3432 times)

BigMark

  • Newbie
  • *
  • Posts: 6
    • View Profile
How to Select the rows of the current page?
« on: December 17, 2013, 02:34:21 pm »
Hi Sir:
     Please see my demo below:
     http://jsfiddle.net/BigMark/D23V9/7/
     I put a check box in a column heading  to control the checkbox.
     But When I select the checkbox of column heading,all the checkboxs are selected, that's not what I want.
I want to select the rows of the current page.
How can I do? thanks a lot !
 

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How to Select the rows of the current page?
« Reply #1 on: December 18, 2013, 09:39:31 am »
All your questions seem to be related to "How to get records on current page?"

you can extend pqGrid by adding a new function to get records on current page as below:

Code: [Select]
$.paramquery.pqGrid.prototype.getDataPage=function(){
  return this.data;
}


For checkbox selections through header checkbox you may follow example code posted here

http://paramquery.com/forum/index.php?topic=376.0

As you want to select checkboxes on current page rather than on all pages, you might need to use this modified code:


Code: [Select]

var data = $grid.pqGrid("getDataPage");
$(data).each(function (i, rowData) {
      rowData["state"] = g_checked ? true : false;
      $grid.pqGrid("selection", { type: 'row', method: (g_checked ? 'add' : 'remove'), rowIndx: i });
});