Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Dec 09, 2008 21:20
open dhtmlx forum
Tab changing

my grid has 5 columns. with in that only 3rd column is not editable. now i want to control the tab. when i press the tab control should directly goes to 2nd column to 4th column. here i am using the code like this but event is not firing.

detailgrid.attachEvent("onTab",function(){
var ind = detailgrid.getRowIndex(detailgrid.getSelectedRowId())+1;
alert("index is "+ind);
var cind=detailgrid.getSelectedCellIndex();
alert("cind is "+cind);
if (ind==this.getRowsNum()) return true; // last row in grid
detailgrid.selectCell(ind,cind);
detailgrid.editCell();
return false;
});

at the same time i right the code on "onEditCell" event. it works fine. but tab change is not working properly.
Answer posted by Support on Dec 10, 2008 01:48
>> when i press the tab control should directly goes to 2nd column to 4th column
If you mean that only two columns need to be active for tab actions

detailgrid.attachEvent("onTab",function(){ 
    var ind = detailgrid.getRowIndex(detailgrid.getSelectedRowId()); 
    var cind=detailgrid.getSelectedCellIndex();

    if (cind==1) cind==3; //tab from 2 to 4
    else if (cind==3) { cind=1; ind++; } //tab to cell 2 on next row

    if (ind==this.getRowsNum()) return true; // last row in grid 
    detailgrid.selectCell(ind,cind); 
    detailgrid.editCell(); 
    return false; 
});