How to handle click click event in jQuery grid

I have a jQuery grid with data with user data. I need to handle a click on a grid line for each grid line, when I click, I need to display another grid at the bottom of the grid.

Some things are very similar to this:

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

Go to Advanced ---> Basic Information

thank

+3
source share
3 answers

onSelectRow is what makes the detail grid loaded with information from the main 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');
                } 
        }
+3
source

This is how you use it

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

NTN

+1
source

Inside the click event, you may need to get the row id. How do you get it?

$("#tblGridMain tr").click(function () {
    var tr = $(this)[0];
    var trID = tr.id;
    alert("trID=" + trID);
});
+1
source

Source: https://habr.com/ru/post/1740213/


All Articles