Author Topic: Hide expand icon and child grid when no child rows  (Read 295 times)

scoular

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 4
    • View Profile
Hide expand icon and child grid when no child rows
« on: November 08, 2023, 03:07:07 pm »
I have nested grids with local data.  How can I only show the expand/collapse icon if child records exist?  I also don't want to render a child grid when no child records exist. 

Also is it possible to change the expand/collapse icon to something else like a +/- instead of the arrow icons?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Hide expand icon and child grid when no child rows
« Reply #1 on: November 08, 2023, 10:40:31 pm »
1. You can implement column.render callback in the detail column and return "" to hide the icon.

Code: [Select]
render: function(ui){
    var rd = ui.rowData;

    if ( condition ){
       return ""; //no icon.
    }
}

2. you can set detailModel.collapseIcon to ui-icon-plus and detailModel.expandIcon to ui-icon-minus. Please see detailModel API

https://paramquery.com/pro/api#option-detailModel

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Hide expand icon and child grid when no child rows
« Reply #2 on: November 09, 2023, 01:44:38 pm »
Example of hiding expand icon.

https://paramquery.com/pro/demos/detail