Categories | Question details Back To List | ||
strange behaviour oncelledit Hi, i have noticed a very strange behaviour on cell edit. i have a function setup as follows: mygrid.attachEvent("onEditCell", function onEditCell(stage,rowId,cellId, newValue, oldValue) { if(stage ==2 && cellId == 0) { if(isLegalString(newValue) == false) { return false; } } return true; }); inside the event i take the newValue and test if it is a legal string (checking all of its characters) if it is not a legal sting, i return false and return true if it is a legal string. i have noticed that if i enter an illegal string on a 'tree' type column, it returns false and the value of that cell is displayed as it was before the edit - which is expected behaviour - but if i attempt to output the following (for the row the on edit just refused): alert(mygrid.cells(mygrid.getSelectedId(), 0).getLabel()); it displays the html code of a textarea e.g. <textarea etc... have you noticed this? is this a bug your end or mine, i cant see any problems my end but if this doesn't occur your end then i will need to look harder!!! thanks very much richard Answer posted by Support on Mar 04, 2008 02:01 If getLabel command called inside onEditCell stage 2 event, or after it - the data must be returned correctly ( and so it is in local samples ) But if you calling this command when cell in edit state ( after edit start and before onEditCell stage 2 ) - the method will return actual cell value, which is code of editor in that moment. To be sure that cell is not in edit state you can call grid.editStop(); before accessing cell data If problem still occurs for you, and it occurs for cell after edit - please provide any kind of sample where problem can be reconstructed ( you can send it directly to support@dhtmlx.com ) Answer posted by Richard White on Mar 05, 2008 12:39 Hi, thanks for the reply. yes it was partly this and partly due to i was saving the data even if it was being returned false. thanks very much Answer posted by Richard White on Mar 05, 2008 13:19 Hi, my apologies, this has not yet been fixed. why on a tree column does stage 2 not occur when it would usually do on any other column type. it appears that when you are editing a tree column that stage 2 occurs when you are actually typing, whereas on other column types stage 2 occurs only when you have completed editing and wanting to come out of the cell? thanks Answer posted by Richard White on Mar 05, 2008 13:21 nope, i have just noticed on many different column types, including ed, that stage 2 is occuring when you are typing. has your developers changed something as stage 2 only used to occur when editing was complete and you wanted to come out of the cell? thanks Answer posted by Support on Mar 06, 2008 06:30 Problem can't be reconstructed locally. The way how onEditCell event generated was not affected by any of latest changes, actually by existing logic this event may occur only when currently active editor closed. If problem still occurs for you - please provide any kind of sample where problem can be reconstructed. ( The only possible reason of something similar - usage of editStop|editStart from inside of onEditCell event, in such case different complex situation possible ) Answer posted by richard white on Mar 06, 2008 08:02 hi, thanks for the reply, sorry about that it must be something to do with my code then. thanks |