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!
FWIW, I'd very much like to see a standalone oData example with igHierarchicalGrid that can do oData CRUD operations on both the main level and child columnLayouts. All the current oData examples are read-only. Any chance someone could whip one up?
Thanks!
If you could do so and do it in a way that I can create some sort of method that I can hook up at creation that will automatically do this without me having to do it on every single data source that would be great.
Obviously having hundreds if not thousands of these in the project there will be a lot of potential for error.
I would suggest that given the landscape and how fast everyone is moving to REST that this needs to be VERY HIGH priority on your development list. Anyone with a REST service is going to expect this. (i.e. everyone on RoR and anyone using mvc.net 4 shortly among almost all others doing new projects on any platform)
Hi,
Thanks for the feedback. I think there are two different topics you are referring to, one is "dependence on ASP.NET MVC" - which is definitely not the case, you can set updateUrl to any service you like, and the posted content is JSON. You can use any server-side backend technology of your choice (PHP, NodeJS, RoR, etc.) , as long as you deserialize the transaction log JSON.
The second one is about supporting RESTful CRUD services out of the box - you are absolutely right this is not the case at the moment. We will consider adding this in the backlog of the product for a future Service or Volume release.
In the meantime, you can also iterate over the transaction log on the client-side, and invoke a separate CREATE / EDIT / DELETE request, assuming you have the URLs , as a workaround. This should be pretty straightforward to do, i will follow up with a sample about how to do this.
Thanks again,
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.
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,