Author Topic: CheckboxColumn  (Read 3321 times)

lucafik

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 17
    • View Profile
CheckboxColumn
« on: March 30, 2015, 09:26:24 pm »
How can I represent the boolean value from the HTML table in a pqgrid.

I have used
type: 'checkBoxSelection', cb: {all: true, header: false}

and created a pqgrid from an html table
var $grid = $("#tbl_for_grid").pqGrid(newObj);

but all of my rows are marked as checked and selected, like this.
http://pokit.org/get/img/f25ebcc2d0b05c277bdb7efa6369e9cd.jpg

I dont want my rows to be selected, and I need the value to correspond the values in the table.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: CheckboxColumn
« Reply #1 on: March 30, 2015, 10:21:30 pm »
you don't need checkBoxSelection column. How are the boolean values stored in the table. If they are just true & false, you could probably display them as true / false in pqGrid too.

lucafik

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: CheckboxColumn
« Reply #2 on: March 31, 2015, 05:32:20 pm »
I can display them as textual true/false, but I need a checkbox that will be checked depending on the value in the html table. Sorry, now I see that my question wasnt quite clear.

Is that possible?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6313
    • View Profile
Re: CheckboxColumn
« Reply #3 on: March 31, 2015, 11:25:03 pm »
If you want to display checkboxes, then implement a render callback for that column.

render: function(ui){
    return "<input type='checkbox' "+ (ui.cellData? "checked='checked'" : "") + "/>";
}

lucafik

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: CheckboxColumn
« Reply #4 on: April 01, 2015, 02:49:44 pm »
thanks, that was the solution!