Hello
I have a SubGrid which opens when clicking the first column with the “plus”. Is there a way to hide the “plus” if there’s no data for showing in SubGrid?
Thank you
Hello
I have a SubGrid which opens when clicking the first column with the “plus”. Is there a way to hide the “plus” if there’s no data for showing in SubGrid?
Thank you
Unfortunately it’s not available.
The subgrid initializing after the “plus” is clicked and it’s not available to get if there is data in the grid before the clicking.
OK
Any way to block the subgrid when there’s no Data? I just want not to open the subgrid if there’s no data because there’s only the header …
Thank you
it is available only if the data is loaded.
For example:
mygrid.attachEvent("onSubGridLoaded", function(subgrid,rId,rInd){
if (subgrid.getRowsNum()==0){
mygrid.cells(rId,rInd).close();
}
});
This works but just the first time. If i click “plus” the second time it opens normally because subGrid is already loaded.
Any idea?
Thank you
Please, try to use the following code:
mygrid.attachEvent("onSubGridLoaded", function(subgrid,rId,rInd){
console.log(subgrid.getRowsNum());
if (subgrid.getRowsNum()==11){
mygrid.cells(rId,rInd).close();
mygrid.cells(rId,rInd).setValue("");
}
});
Sorry but happens nothing … now SubGrid opens normally …
I apologize:
mygrid.attachEvent("onSubGridLoaded", function(subgrid,rId,rInd){
console.log(subgrid.getRowsNum());
if (subgrid.getRowsNum()==0){
mygrid.cells(rId,rInd).close();
mygrid.cells(rId,rInd).setValue("");
}
});
Still happens nothing …
Here is my GRID:
Grid[1] = new dhtmlXGridObject('gridbox');
Grid[1].setImagePath("../../../dhtmlx/Grid/codebase/imgs/");
Grid[1].setHeader(",<span style='padding-left:10px'>WO</span><br><span style='padding-left:10px'>INT</span>,<span style='padding-left:8px'>WO</span><br><span style='padding-left:8px'>UM</span>,<span style='padding-left:5px'>Eingang</span>,<span style='padding-left:7px'>Erledigt</span>,<span style='position:relative;left:-5px'>Kunde</span>,<span style='position:relative;left:-5px'>Strasse</span>,<span style='position:relative;left:-1px'>Hs</span><br>Nr,,Plz,<span style='padding-left:29px'>Ort</span>,<span style='position:relative;left:-5px'>Typ</span>,<span style='padding-left:12px'>Folge-</span><br><span style='padding-left:12px'>ticket</span>,Service-<br><span style='padding-left:7px'>code</span>,<span style='padding-left:4px'>Wtg</span>,Anlage,<span style='position:relative;left:-5px'>ÜP Adresse</span>");
Grid[1].attachHeader(",#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_text_filter,#connector_select_filter,#connector_select_filter,#connector_select_filter,#connector_text_filter,#connector_select_filter,#connector_text_filter,#connector_text_filter");
Grid[1].setInitWidths("24,55,52,70,70,110,*,30,25,40,100,30,74,58,50,55,*");
Grid[1].setColAlign(",center,center,center,center,left,left,center,center,center,center,center,center,center,center,center,left");
Grid[1].setColTypes("sub_row_grid,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro");
Grid[1].enableTooltips("false,false,false,false,false,true,true,false,false,false,false,false,false,false,false,false,true");
Grid[1].enableRowsHover(true, 'grid_hover');
Grid[1].attachEvent("onXLS", function() {document.getElementById('loading').style.display = 'block';});
Grid[1].attachEvent("onXLE", function() {
document.getElementById('loading').style.display = 'none';
ToolBar.setItemText("wo", "<font color='#900'><b>Aufträge: </b></font>"+Grid[1].getRowsNum());
});
Grid[1].objBox.style.overflowX = "hidden";
Grid[1].objBox.style.overflowY = "auto";
Grid[1].setAwaitedRowHeight(25);
Grid[1].enableMultiline(true);
Grid[1].attachEvent("onSubGridCreated", function(subGrid, rId, rInd){
subGrid.setImagePath("../../../dhtmlx/Grid/codebase/imgs/");
subGrid.setHeader("<span style='position:relative;left:-4px;color:#900;font-weight:bold'>Termin</span>,<span style='padding-left:10px;color:#900;font-weight:bold'>Techniker</span>,<span style='color:#900;font-weight:bold'>Kostenstelle</span>,<span style='padding-left:70px;color:#900;font-weight:bold'>LP</span>,<span style='position:relative;left:-4px;color:#900;font-weight:bold'>Material</span>,<span style='position:relative;left:-4px;color:#900;font-weight:bold'>Mehraufwand</span>");
subGrid.setColTypes("ro,ro,ro,ro,ro,ro");
subGrid.setInitWidths("110,100,90,180,*,300");
subGrid.setColSorting("str,str,str,str,str,str");
subGrid.setColAlign("center,center,center,center,left,left");
subGrid.enableTooltips("false,false,false,true,true,true");
subGrid.enableRowsHover(true, 'grid_hover_sub');
subGrid.setAwaitedRowHeight(45);
subGrid.enableMultiline(true);
subGrid.init();
subGrid.load("../../../dhtmlx/Data/XML/grid.php?id=42&wonr="+Grid[1].cells(rId, 0).getValue(),function(){
subGrid.callEvent("onGridReconstructed",[]);
Grid[1].setSizes();
});
subGrid.enableAlterCss("rows_even_sub", "rows_uneven_sub");
dhtmlxEvent(window, "resize", function(){ window.setTimeout(function(){ subGrid.callEvent("onGridReconstructed",[]); },200); });
return false;
});
Grid[1].attachEvent("onSubGridLoaded", function(subGrid,rId,rInd){
console.log(subGrid.getRowsNum());
if (subGrid.getRowsNum() == 0){
Grid[1].cells(rId,rInd).close();
Grid[1].cells(rId,rInd).setValue("");
}
});
Grid[1].init();
Grid[1].setSkin("dhx_skyblue");
Grid[1].enableSmartRendering(true, 100);
Grid[1].enableAlterCss("rows_even", "rows_uneven");
Grid[1].load("../../../dhtmlx/Data/XML/connector.php?id=10&j=<?php echo $_GET['j']; ?>");
Thank you
Unfortunately the issue cannot be reproduced locally.
Please, provide with a complete demo, where the issue can be reconstructed.
Here you can find a tutorial:
docs.dhtmlx.com/doku.php?id=othe … leted_demo