Author Topic: cellClick for nested grid.  (Read 207 times)

Aleutian

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 4
    • View Profile
cellClick for nested grid.
« on: May 11, 2023, 05:10:28 pm »
I have created a nested grid and am attempting to add a cellClick event. I have added the code, but it only works on the main grid, not the nested.
        detailModel: {
            //cache: false,
            collapseIcon: "ui-icon-plus",
            expandIcon: "ui-icon-minus",
            init: function (ui) {
                  var rowData = ui.rowData,
                      detailobj = gridDetailModel($(this).pqGrid('instance'), rowData), //get a copy of gridDetailModel                       
                      $grid = $("<div></div>").pqGrid(detailobj); //init the detail grid.
                      $grid.on ( "cellClick", function( event, ui ) {} );
                  return $grid;               
            }
I have also attempted to add a cellClick in the gridDetailModel function, but it also only works on the main grid.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6126
    • View Profile
Re: cellClick for nested grid.
« Reply #1 on: May 11, 2023, 05:46:01 pm »
Please correct it to

Code: [Select]
  $grid = $("<div></div>").pqGrid(detailobj), //init the detail grid.
  grid = $grid.pqGrid('instance');

grid.on('cellClick', function(evt, ui){
alert('cellClick');
});
  return $grid;

Alternatively you can also add cellClick event callback to gridDetailModel

Aleutian

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: cellClick for nested grid.
« Reply #2 on: May 11, 2023, 08:17:26 pm »
Perfect, thanks.