Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to handle row click event in jQuery grid

Tags:

jquery

I have a jQuery grid with data with user data. I need to handle the click on grid row for each grid row when I click I need to display other grid in the bottom of the grid.

Some thing like very similar to this:

http://www.trirand.com/blog/jqgrid/jqgrid.html

Go to Advanced ---> master details

Thanks

like image 944
kumar Avatar asked Feb 03 '26 06:02

kumar


2 Answers

the onSelectRow is what is making the details grid load the information from the master grid.

   onSelectRow: function(ids) { 
            if(ids == null) {
                    ids=0; 
                    if(jQuery("#list10_d").jqGrid('getGridParam','records') >0 ) 
                    { 
                        jQuery("#list10_d").jqGrid('setGridParam',{url:"subgrid.php?q=1&id="+ids,page:1});
                        jQuery("#list10_d").jqGrid('setCaption',"Invoice Detail: "+ids) 
                        .trigger('reloadGrid'); 
                    }
                } else { 
                    jQuery("#list10_d").jqGrid('setGridParam',{url:"subgrid.php?q=1&id="+ids,page:1}); 
                    jQuery("#list10_d").jqGrid('setCaption',"Invoice Detail: "+ids)
                    .trigger('reloadGrid');
                } 
        }
like image 166
Glennular Avatar answered Feb 04 '26 23:02

Glennular


This is how you use it

$("#tablename tr").click(function(){//do what needs to be done});

HTH

like image 21
Raja Avatar answered Feb 05 '26 01:02

Raja