Categories | Question details Back To List | ||
dhtmlxGrid cell handling problem dear sir, what i am facing a problem is mention below i have a user.html page on which the grid is displayed. The grid contains lot of record. To make the processing fast i am using mygrid.setSerializationLevel(true,false,true,false,true); command that means only changed row will be shown. But the problem is i want to do below activity. - double click the cell - then click the 'delete' button(on same html) - what the functionality i want to do is make the cell value to blank. - and while submit the row should be the serialize with the blank value cell. i am using the command mygrid.cells(rowId,columnId).setvalue(""); in 'onclick' of delete button function. here rowId and columnId is maintained while in stage == 0 of onCellEdit event. what the actual problem, why the cell value is not replaced with the blank. Interesting thing is that mygrid.setCellTextStyle(iRow,iCol,"background-color:red" ); is functioning in 'onclick' of delete button. plz help Answer posted by Support on Dec 23, 2008 07:29 The cells marked as changed when they changed by user and not react on changes caused by API The simple solution is extend your code as mygrid.cells(rowId,columnId).setValue(""); mygrid.cells(rowId,columnId).cell.wasChanged=true; //mark cell as changed manually Answer posted by sandip on Dec 23, 2008 22:10 function name is very confusing, let say, on stage 2 of onEditCell event if we changed the value of the cell then the value is not able to set, so i used mygrid.cells(rowId,columnId).setValue(NewVal); but error console give errors... so i tried mygrid.cells(rowId,columnId).setvalue(NewVal); then it works(able to set the new value onEditCell event). But when i am using the same command(mygrid.cells(rowId,columnId).setvalue(NewVal);) other then the event handling function then its not working, error console is showing that setValue(NewVal) is not a function. So I got very confused. Even you had suggested above to use 'mygrid.cells(rowId,columnId).setValue("");' command. Still i am not able to find the solution one of the above asked query that, i want to make the cell blank from any function. your solution mygrid.cells(rowId,columnId).setValue(""); did not work. I tried with mygrid.cells(rowId,columnId).setvalue(""); also. so were i am wrong Answer posted by Support on Dec 24, 2008 02:31 the correct name of function is setValue ( you can reffer to API list - http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Excell_API_reference.html#grid_excellsapi ) >>if we changed the value of the cell then the value is not able to set Problem caused by moment of command call, the stage 2 of onEditCell is moment when editor already closed but new value not set yet ( this is key point from which new value may be accepted or rejected ) , so the direct call of setValue may be reset by folowing logic. You can use specific of onEditCell event and use mygrid.attachEvent("onEditCell",function(stage,id,ind,val){ if (stage == 2 && some_condition) return NewVal.toString(); return true; }); When you returning string value from onEditCell handler - such value will be used as new cell value, instead of one entered by user. >>mygrid.cells(rowId,columnId).setValue(""); This code will work in common case, but will not work for cell , which in edit-ending process if called from onEditCell event hander |