Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
REST + CRUD Sample
posted

Is there a sample somewhere of doing RESTFUL CRUD operations on the datasource?

I.e. I need to be able to have all changed records get posted in an json array to a PUT method, Inserts to a POSt in a json array, and deletes as the URL with a parameter repeated for each of the primary keys for the deleted records.

 

I'm not finding any documentation on how to do this at all, and the samples are only showing a single "update" url instead of broken down ones.

Thanks for any assistance!

Parents
No Data
Reply
  • 24671
    posted

    Hi,

    you don't need multiple URLs in order to achieve CRUD, because what's sent in the POST request (when your Update URL is hit) is a serialized JSON list of transactions, where each transaction has a type - update, delete, add, etc. So you need to handle the transaction list, as it is described in the following help link, and that should do:

    http://help.infragistics.com/Help/NetAdvantage/jQuery/2012.1/CLR4.0/HTML/igGrid_Updating.html

    if you aren't using .NET, you can take the ig_transactions param from the request and parse it using your server-side technology/language of choice . the "type" property of every transaction in the list specifies whether it's an "add", "delete", etc. "type" can take the following values:

    1) "cell" - it means a cell was updated, then you can use the value property to get the new value

    2) "row" - updating of a row

    3) "addrow" 

    4) "deleterow" 

    Hope it helps. Thanks,

    Angel

Children