optikalefx / OpenJS-Grid

OpenJS Grid is the easiest jQuery Grid ever. With very little work you can have a data grid that can do everything from sorting and searching to complex database queries. Best of all, its open source. So you can learn how it's all done.
http://square-bracket.com/openjs
MIT License
96 stars 46 forks source link

checkbox used only 1-0 values #24

Closed rami1973 closed 11 years ago

rami1973 commented 11 years ago

"checkbox": function(value, columnOpts, grid) { if (value=="Y"){ var checked='checked="checked"'; }else{ var checked=''; } but if i check or uncheck it uses 0 and 1 values is there any solution for that.

rami1973 commented 11 years ago

I solve it like this I hope it's right way: on("cellClick",function(e, $cell,rowData) { // alert(rowData.user_allowed); if(rowData.user_allowed==0){ rowData.user_allowed='N';} else { rowData.user_allowed='Y'; }

optikalefx commented 11 years ago

Checkboxes are for 0 and 1 values only right now. If you want to change that, in your PHP, just grab the POST and change the 1 to Y and the 0 to N there. There isn't an option on the grid in JS to change that.

For efficiency you should be using TINYINT(1) for saving this in your database though. Not CHAR(1) for Y and N. So you should stick to 1 and 0, and change your database. You dont have to, but I would recommend it.

Thanks!