Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Scott on Oct 01, 2009 21:30
open dhtmlx forum
Grid with delete icon

I've implemented dhtmlxgrid with the data connector, works well with RPC.

I'm trying to setup a delete button on the rows, so you can click the red cross beside a row and it deletes it. The problem is that it just puts a strikeout through the row, it isn't actually removed from the grid.

I've tried tweaked dhtmlxdataprocess.js:
deleted:"display: none;", //text-decoration : line-through;

The CSS tweak works fine, it hides the row. The problem is that the same product can then be scanned back into the grid (I'm putting together a barcode scanning inventory system). When the new row is added, it's added with the same product id, so I presume it overwrites the old row, but the display:none is still attached. I really just want the row deleted, not hidden.

The perfect functionality is:
when a user clicks the delete icon beside a row, I want an RPC request to ask permission, the RPC responds with "yes, deleted" or "no, error of type X". The dhtmlxgrid either removes the row or leaves the row intact with a popup error. This is pretty vanilla functionality, do you have an example I can look at?

Thanks guys.
Answer posted by dhxSupport on Oct 02, 2009 01:41
To actually delete row you should use mygrid.deleteRow(rowId) method. Necessary row will be deleted and DataProcessor will send request to the server side with information about deleted row. 
You can attach "onclick" event to the image, show prompt to the user and then delete row or not.