Hi
I just upgraded to version 4 and have three problems with grid.
- The selectCell function option to put cell into edit mode does not work. The cell is selected but does not enter edit mode. (note I am using dataProcessor so this might affect it somehow). Code is below.
function installTypes(tabs,tabid){
var itLayout = tabs.cells(tabid).attachLayout('2U',"dhx_skyblue");
itLayout.cells('a').setWidth(253);
itLayout.cells('a').hideHeader();
itLayout.cells('b').hideHeader();
itToolbar = itLayout.cells('a').attachToolbar();
itToolbar.setIconsPath("imgs/");
itToolbar.addButton("add", 1, "", "Add-icon.png", "Add-icon.png");
itToolbar.addButton("remove", 2, "", "Remove-icon.png", "Remove-icon.png");
itToolbar.attachEvent("onClick", function(id){
switch(id){
case 'add':
itGrid.addRow(99999,'new row');
itGrid.selectCell(itGrid.getRowsNum()-1,0);
window.setTimeout("itGrid.editCell();", 300);
//itGrid.editCell();
break;
case 'remove':
itGrid.deleteSelectedRows();
break;
}
});
itGrid = itLayout.cells('a').attachGrid();
itGrid.setImagePath("lib/dhtmlx/imgs/");
itGrid.setHeader("Name");
itGrid.setColumnIds("name");
itGrid.setColTypes("ed");
itGrid.setInitWidths("247");
itGrid.setSkin("dhx_skyblue");
itGrid.init();
url = urlPlusRandom("php/installTypes.php?x");
itGrid.load(url);
itDP = new dataProcessor(url);
itDP.init(itGrid);
};
-
If I use selectCell then editCell it still does not work. There is a timing problem and using setTimeout for the editCell is a workaround.
-
Using editCell the Enter and Escape keys are disabled so the user can only save the cell by clicking on another cell or row.
Can someone please help with issue 3. I want the user to be able to press enter to save the cell value or escape to cancel. Note that this only occurs when editCell is called. If the user double clicks a cell to edit it - it works fine.