Categories | Question details Back To List | ||
Grid DataProcessor issue when inserting new row I encountered an issue with my dataprocessor enabled dhtmlXGrid. I'm using a user defined data processor since I'm using .NET technologies. Here's my definition of the dataprocessor: mygrid.load('data.ashx','json'); myDataProcessor = new dataProcessor('data.ashx/data/'); myDataProcessor.setUpdateMode('row'); myDataProcessor.init(mygrid); Updating works just fine, but when inserting a new empty row into the grid the whole dataprocessor seems to hang. After adding the empty row, the dataprocessor is not called at all... I first have to click on the newly added row, and without typing anything the dataprocessor will be called with the correct id of the row and nativeeditor_status = inserted. Why is that? I would have expected that the dataprocessor would be called either directly when adding an empty row, or when finished typing in data. Now, I type in something in the cells of the added row and after I finished typing the dataprocessor gets called again, this time with the values I typed but again in nativeeditor_status = inserted mode? Well, would be no problem at all, but when I try to update another row afterwards it simply gets marked as changed, but the dataprocessor will never be called again for any row in the whole grid. Here's the XML String I return when the insert in the data processor is first called : <data><action type='insert' sid='0' tid='b2d118e5-c6f2-408c-ba9e-644dbbae3401'/></data> After this, I am not able to update another row. If you could please enlighten me that would be very helpful. Also, when inserting an empty new row I'm using this javascript to select and highlight the new row and switch the first cell to edit mode... but this seems not to work: (lnkId is a unique id for the new row, lnk is a server side button) lnk.OnClientClick = "mygrid.addRow('" + lnkId + "','" + lnkId + "',-1);mygrid.selectRow('" + lnkId + "');mygrid.showRow('" + lnkId + "');var _id = mygrid.getRowIndex('" + lnkId + "');mygrid.selectCell(_id + 1,1, false,true);return false;"; Thanks in advance, David Answer posted by Support on Jul 01, 2008 03:44 >>Why is that? I would have expected that the dataprocessor would be
called either directly when adding an empty row, or when finished
typing in data.
You are using the "row" update mode. In such mode the data sent to server when - enter key pressed - selected row changed When you clicking on new row - selection changed and data send to the server. >><data><action type='insert' sid='0' t Is "0" correct sid value ? You must not use 0, null, undefined as row ID values, it may cause issue described in your situation >>Ink is a server side button) If it is unique ID , the server side response above is incorrect for sure, it must contain correct value of source ID instead of 0 >> but this seems not to work: replace selectRow witn selectRowById, becuase selectRow accept row index as parameter, not ID Answer posted on Jul 01, 2008 07:27 Thanks for your fast reply. >> If it is unique ID , the server side response above is incorrect for sure, it must contain correct value of source ID instead of 0 Fixed this, and got the dataprocess working properly now! >> replace selectRow witn selectRowById, becuase selectRow accept row index as parameter, not ID var _id = mygrid. getRowIndex('" + lnkId + "');mygrid.selectCell(_id,1,false,true); Answer posted by Support on Jul 01, 2008 09:11 >>mygrid.selectCell(_id,1,false,true); The edit is 5th parametr of selectCell, so you need to use mygrid.selectCell(_id,1,false,false,true); or mygrid.selectCell(_id,1) mygrid.editCell(); Please beware that if you are calling such code from some onclick event from external event, the situation may occurs when editor still not be opened - onclick event started - your code open cell for editing - grid detect click outside of grid borders - grid closes active editor and switch to passive state |