Hi my problem is this:
I am using a dhtmlxgrid and I am using the method addRow but the new row is not using the
attached events like all the rows of the grid,
in this case I wrote a function for the onEnter event in the cells, and works fine
mygrid.attachEvent(“onEnter”, function(id,ind)
{
var jairo = mygrid.getUserData(id,“valorfila”);
var a=mygrid.getRowsNum();
var cols = mygrid.getColumnsNum();
jairo--;
a--;
//alert("id "+id+" ind "+ind+" jairo "+jairo+" cols "+cols+" a "+a);
if((jairo==a)&&(cols==(ind+1)))
{ //make the new file
var rowsAll = mygrid.getAllRowIds(","); // delimiter to use in the list should be specified
var n = new Array();
n=rowsAll.split(",");
elem=n.length;
ma=0;
for(i=0;i<=elem;i++)
{
if(parseInt(n[i])>ma)
{
ma=n[i];
}
}
ultimo=parseInt(ma)+1;
var newId = ultimo;
mygrid.addRow(newId,"",mygrid.getRowsNum());
mygrid.selectCell(newId,1);
mygrid.editCell();
window.setTimeout(function()
{
//alert("se metio");
//mygrid.selectRow(newId,false,false,true);
mygrid.selectCell(newId,1);
mygrid.editCell();
},10);
}
else
{
if((ind+1)<cols)
{ //passes to the next column
window.setTimeout(function()
{
mygrid.selectCell(jairo,ind+1,false,false,true,true);
mygrid.editCell();
},10);
}
else
{ //go to the new row
window.setTimeout(function()
{
mygrid.selectCell(jairo+1,1,false,false,true,true);
mygrid.editCell();
},10);
}
}
//alert("fila "+id+" columna "+ind+" ");
});
but I need that this function can be used for the new created rows,
how this can be done ?
Why the new rows and his cells don’t use the methods defined in attach events for the grid ? like the others
And what is te correct method for the new rows to accept the attach events like
mygrid.attachEvent(“onEnter”, function(id,ind)
{
.
.
.
.
}
thaks for all your help!!!