Page 1 of 1

select grid rows

Posted: Thu Jun 14, 2018 6:37 am
by m400mail
Hello to *ALL,

i have a grid and i want to checked/unchecked the Grid rows.
pic01.PNG
pic01.PNG (15.22 KiB) Viewed 489 times
the checkbox starts a Javascript to do this

Code: Select all


var myGrid = getObj("Grid01");
var myRows = myGrid.grid.getRecordCount();
var newVal = get("HdrCheckBox");

for (var x = 1; x <= myRows; x++) {
  myGrid.grid.setDataValue(x, "CK_PRINT", newVal);
}

This function sets the value for all rows.

if the user filters the lines, I only want to mark the filtered lines.
How can i do this

Thanks for your help
Michael

Re: select grid rows

Posted: Thu Jun 14, 2018 9:50 am
by DanD
Hi Michael,

Please try the following to only change the values of the rows that are not filtered out:

Code: Select all

var myGrid = getObj("Grid01");
var newVal = get("HdrCheckBox");

for (var x=0; x<=myGrid.grid.getRecordCount(); x++) { 
   if (!myGrid.grid.isRowFilteredOut(x)) { 
      myGrid.grid.setDataValue(x, "CK_PRINT", newVal); 
    }
   }
myGrid.grid.render();
-Dan

Re: select grid rows

Posted: Thu Jun 14, 2018 10:38 am
by m400mail
Hi DanD,

great the function runs .
thanks a lot
michael