Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tim on Dec 13, 2009 12:41
open dhtmlx forum
keeping subrows open

Hello,

I have setup a subrow to load some extra content into rows of my grid. I have used the following code to open/expand the subrow when the row is selected:

invGrid.attachEvent("onRowSelect", doOnRowSelected);

function doOnRowSelected(id) {
if (id != oldId) {
invGrid.cells(id,0).open();
}
oldId = id;
}


1. I use the oldId variable only so if the same row is selected, the content does not refresh. Is this the best way to do this?

2. When I edit a cell in the grid, the subrow is automatically closed. How can I keep the subrow always open, no matter what events happen on the grid?

Thanks!
-Tim
Answer posted by dhxSupport on Dec 14, 2009 06:36
Try to use following code to open sub row:

mygrid.attachEvent("onRowSelect",function(rowId){
var exp=mygrid.getRowById(rowId)._expanded
var editor=mygrid.editor;
  if (!exp||!editor) {
window.setTimeout(function(){
mygrid.cells(rowId,0).open();
  },500)
  }
});