Add checkbox column to flexigrid

Jquery flexigrid issue using php. Unfortunately, the http://flexigrid.info site is very common so I managed to take some sample code from http://sanderkorvemaker.nl/test/flexigrid/ and worked on that basis.

Now the above code example works, I have to create a grid with a checkbox column. For me to be able to click a couple of those checkboxes and hit the delete button, it has to get the entire id where the checkboxes are checked and create a delete request and execute.

Can anyone give me an example please

Thanks in advance

+2


a source to share


2 answers


I think you don't need a checkbox anymore, since flexigrid rows can be split.

however, if you really want to continue this idea .... in your php file that processes grid data to json, you can just add a checkbox in the cell with the id on it i.e.

while(true){
        $json .= ",";
        $json .= "\n{";
        $json .= "id:'".$id."',";
        $json .= "cell:['".$col1."',";
        $json .= "'".$col2."',";
        $json .= "'<input id=\"dataid".$id."\" class="datacb" type=\"checkbox\" value=\"".$id.""\/>'";
        $json .= "]\n";
        $json .= "}";
}

      



in your javascript file in the delete function

    var ids;
$('.datacb').each(function(){ if($(this).is(':checked')){
  ids += $(this).val()+",";   } });

      

/ * send php ids for processing * /

+4


a source


add "showCheckbox: true"

to options to add checkbox



+1


a source







All Articles