How to force grid to collapse already opened subrows if user opens another one by clicking on [+] button.
You can close|open sub-levels programmatically by
grid.cell(i,j).open();
grid.cell(i,j).close();
but there is no any event in current version of grid, which can be used to organize necessary behavior
You can add any custom code to the
dhtmlxgrid_excell_sub_row.js, line 72
dhtmlXGridObject.prototype._expandMonolite=function(n,show,hide){
I’ve tried modifying it. In code outside this file I’ve just used collapsMonolite() function to close all rows, however I do not know on which object I can call it within dhtmlXGridObject.prototype._expandMonolite=function(n,show,hide){…
I’ve tried ‘this’ and ‘this.grid’ but it always returns object undefined error. Can you give me an exact code that I should put into dhtmlXGridObject.prototype._expandMonolite=function(n,show,hide){ to collapse all subrows?
Got it… not sure if it is absolutely correct but it works for now…
I’ve changed
…
d.className=“dhx_sub_row”;
that.objBox.appendChild(d);
that._detectHeight(d,td)
}
if (!that._flow) {
…
to
…
d.className=“dhx_sub_row”;
that.objBox.appendChild(d);
that._detectHeight(d,td)
}
that.selectRow(row);
that.getAllRowIds(",").split(",").each(function(id) {
if ((that.rowsAr[id]._expanded) && that.rowsAr[id]!=row)
that.cellById(id,0).close();
});
if (!that._flow) {
…