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!
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
While this is a good hack for MVC.NET it is NOT REST.
REST ALWAYS has GET (Read), POST (insert), PUT (update) and DELETE functions that are called.
They are ALWAYS of the correct content type and request type in HTTP and ALWAYS follow specific rules.
If I wanted this to just work with MVC.net I'd use Infragistics (or anyone else's) mvc.net controls. There would essentially no reason to use a jquery based library because every mvc.net library I have ever seen uses jquery and works against MVC's anitquated web services and/or AJAX calls.
However THE STANDARD is REST + JSON. All libraries should follow this pattern. (i.e. if you were to use these controls in RoR then you would have to follow this pattern, because this is how it's done. Same with most other current languages.
That means that Updates, INSERTS and Deletes must be sent to their own endpoints. I'm obviously not going to write a wrapper in mvc.net to call REST services nor should that be expected given what jquery controls are all about.
Further, mvc.net 4 includes Web API which is fully restful and follows all of the rules as well. Again this is the defacto standard and is taking over rather quickly from SOAP web services.
Thus I expected a REST data source that can work in batch mode as well as single object mode. It should POST with a json array in batch and a single json object in non-batch (i.e. JSON.stringify()) for inserted records that need to be persisted, PUT in the same manner for updates to be persisted and send a list of IDs as parameters on the URL as described for deletes.
The request type should be set appropriately for each type of request.
My question is simply: Is this possible with Infragistics jquery or is it completely bound to mvc.net for some odd reason?
And if it's possible, what's the timeline for a true REST data source? (I would have expected that like Kendo it would have come with one out of the box because as I said, this is the standard for anything jquery.)
I'm trying to decide if I'm wasting my time with the infragistics controls or if it's worth pursuing. This is the one major roadblock and a surprising one that that.