Author Topic: Setting for treeModel to hide the open/close icon and slight render bug  (Read 170 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 213
    • View Profile
Would like to be able to have a treeModel setting that hides the open/close branch icon when "children" of a node is empty.  At the moment, the only way to do this is to delete/ommit children, which can be slow as I need to loop through the rows.  Also I might drag or delete the only child row out of a parent, yet the parent still has an expand option.

My current fix/hack is in render:

Code: [Select]
if(ui.rowData["children"] && ui.rowData["children"].length==0)
{
delete ui.rowData["children"];
// Queue a micro-task to instantly redraw the row as a leaf (removes the arrow natively)
var grid = this;
setTimeout(function(){ grid.refreshRow({ rowIndx: ui.rowIndx }); }, 1);
}


BUG:
Also if you look at the first "case 0".  In normal render, the "attr" value can be a string or an object, in this render it can only be a string

Code: [Select]
icons: true,
render: function(ui){
switch (ui.rowData["TYPE"]) {
case 0: return {iconCls:"ui-icon-folder-open", attr:{title:"Not working"} }; break;   // <--- attr can't be an object here
case 1: return {iconCls:"ui-icon-cart-b", attr:"title='This works'"}; break;
case 2: return {iconCls:"ui-icon-gear"}; break;
case 3: return {iconCls:"ui-icon-radio-off"}; break;
.....
}
},
« Last Edit: July 14, 2026, 05:31:36 am by jplevene »