Categories | Question details Back To List | ||
dataProcessor - How to send only parts of data Hi, I have a grid with a dataprocessor. I have my dataprocessor configured like so: oDP.setUpdateMode("off") oDP.setTransactionMode("POST", true) This way all data is sent to server once I hit the "Save" button. My problem is that I also have a "Delete Rows" button which I use to delete all selected rows. My dilemma is if a user makes an edit to one row...and then decides to highlight another row(s) to delete it. When the user hits "Delete Rows", it will delete the selected row(s)...but will also send the updated/inserted data to the server, because I need to perform a oDP.sendData() action to finalize the delete. This is all processed just fine in my save routine which handles all inserts, deletes or updates dependent on the _!nativeeditor_status value of the row, but my wish is to only send the selected rows to the server when the "Delete Rows" button is clicked and to only send updated/ inserted rows to the server when the "Save" button is clicked. Is this possible? Suggestions? ps. I know that setting setUpdateMode = true would solve this problem, but my grid is a child grid within a parent form...So I don't want part of the form to be saved with a save button and the other part of the form (the grid) to be saved automatically after each edit. This may confuse the users. Answer posted by Support on Jul 08, 2009 01:47 DataProcessor doesn't separate different types of updates, but you can use dp.sendData(row_id); In such case, dataprocessor will send info only about one specified row. If you need to send multiple rows , you can try to use the next approach var up = dp.updatedRows; var dp.updatedRows=[]; for (var i=0; i<up.length; i++) if (dp.getState(up[i])=="deleted") dp.updatedRows.push(up[i]); dp.sendData() dp.updatedRows = up; Above code will filter list of updated rows, so only deleted will be sent to server. Answer posted by Michael on Jul 10, 2009 06:54 Could you clarify what you are doing with this line of code? var dp.updatedRows=[]; It does not seem to work. It looks like your reseting it to an empty array, but dp.updatedRows gives me a comma delimited string. Answer posted by Michael on Jul 10, 2009 07:13 Sorry the line of code above seems to be fine as long as I remove the var and it is an array, but I have another problem with the .getState(). It says object does not support this property. Answer posted by Support on Jul 10, 2009 07:58 >>Could you clarify what you are doing with this line of code? dp.updatedRows - array of IDs >> I have another problem with the .getState() Which version of dataprocessor you are using? In case of old one, getState can be replaced with if (dp.obj.getUserData(up[i],"!nativeeditor_status")=="deleted") Answer posted by Michael on Jul 10, 2009 08:17 Thanks that did it. |