no

Flexigrid's on row click - How to implement rowClick action of flexigrid using codeigniter's library

The objective of this writing is to update the flexigrid library so that it can handle the rowClick event. To do this we need to download t...

The objective of this writing is to update the flexigrid library so that it can handle the rowClick event.

To do this we need to download the latest version of flexigrid's library here:
http://flexigrid.eyeviewdesign.com/, extract and setup accordingly inside the codeigniter's library.

How to do:

1.) Modify the flexigrid_helper.php inside the codeigniter's application/helper folder.
At line 82 you should see this line:

$grid_js .= "{display: '".$value[0]."', ".($value[2] ? "name : '".$index."', sortable: true," : "")." width : ".$value[1].", align: '".$value[3]."'".(isset($value[5]) && $value[5] ? ", hide : true" : "")."},";
//Replace with:
$grid_js .= "{display: '".$value[0]."', ".($value[2] ? "name : '".$index."', sortable: true," : "")." width : ".$value[1].", align: '".$value[3]."'".(isset($value[5]) && $value[5] ? ", hide : true" : "").(isset($value[6]) ? ", process : $value[6]" : '').""."},";
//Notice that we add a handler for the 6 colModel attribute.


2.) Therefore we have to add that 6th parameter to the colModel array like this:
$colModel['id'] = array('ID', 100, TRUE, 'center', 1, 0, 'rowClick');
Note: if you want each row to do the same action just add the last two parameters to each colModel items.

3.) Finally, in our view we need to implement the javascript function rowClick:

function rowClick(celDiv, id){
$(celDiv).click(
function() {
alert(id);
}
)
}

Related

php 1866028747197420203

Post a Comment

item