views:

641

answers:

1

The issue about jquery flexigrid using php. unfortunately http://flexigrid.info site is down very often so managed to take some sample code from http://sanderkorvemaker.nl/test/flexigrid/ and worked based on that.

The above sample code works now I need to create a grid with a column with checkboxes, So that I can click a couple of those checkboxes and click delete button it should get all the id in which the checkboxes are checked to and create a delete query and execute.

Can anyone give me an example please

Thanks in advance

+1  A: 

i think you dont need the checkbox anymore since the flexigrid rows are seletable.

however if your really want to go on with that idea.... in your php file which processes the grid data on json you can just add the checkbox at the cell with an 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 under delete function

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

/*send ids to php for processessing */

Jrubins