deleting a row in a data grid

Posted by meyrick on 05-May-2014 09:29

Hi there

I have linked a temp-table to a data grid on my mobile app. I am using input controls in my grid so that the user can amend a column in the row if they need to. I now need to put a button at the end of each row to allow the user to delete the temp-table record if they need to. From the client side how do i flag the row for deletion? is it possible to mark- row-state so that when i loop through my dataset on the appserver side i look for the where the rowstate is  equal to ROW-DELETE and delete this record? Can someone please advise on a approach on how to do this or on an alternative if the above is not possible.

Posted by Peter Judge on 09-May-2014 08:07

There's a remove() method in the JSDO. The snippet below is an example of its use.

var vehicle = VehicleOrderService_BrandDataService_JSDO.jsdo
  .eVehicle
  .findById($(selectedElement).attr('data-vehicle-id'));

vehicle.remove()


When you remove a record client-side, you can then call an *_Update service operation. That will cause the delete operation to be called on the server, and you can now find and mark PDS records as deleted. Make sure that when you call the Update operation that you supply an _id value (you can map it from localStorage) so that the JSDO knows which record you are updating.

hth,

-- peter

All Replies

Posted by Phillip Molly Malone on 09-May-2014 07:56

Hi Meyrick,

Allowing Before-Images is on the cards for OpenEdge 11.4 and this would do the job you are after. Other then that, you would probably have to have a hidden field in the temp-table to handle this behaviour or delete the rows on a row by row basis. I would need to check if there are other options but thats my first thought.

Let me know if this helps.

Posted by Peter Judge on 09-May-2014 08:07

There's a remove() method in the JSDO. The snippet below is an example of its use.

var vehicle = VehicleOrderService_BrandDataService_JSDO.jsdo
  .eVehicle
  .findById($(selectedElement).attr('data-vehicle-id'));

vehicle.remove()


When you remove a record client-side, you can then call an *_Update service operation. That will cause the delete operation to be called on the server, and you can now find and mark PDS records as deleted. Make sure that when you call the Update operation that you supply an _id value (you can map it from localStorage) so that the JSDO knows which record you are updating.

hth,

-- peter

This thread is closed