How to process the XML response from server and bound the result to Grid?
In the below code snippet, we have extended processResponse method of the ej.UrlAdaptor and in the extended method, the xml data from the server is converted into JSON array. Now it can bound with grid. In the following code, we have performed simple Xml to Json conversion in the function “ConvertToJSON”, which will parse the simple xml document to json, for complex xml parsing, you can use external libraries.
Now let us see, how to use the above custom adaptor (named xmlAdaptor) in the grid. Render the grid and assign the custom adaptor to the grid datasource in the grid Load event.
Angular 2 with MVC backend
Figure 1. Response from the server as XML
Figure 2. Grid with data from XML source
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|
|3376||01/23/2015||07/11/2018||ASP.NET Web Forms||DataManager|
or the page will be automatically redirected to sign-in page in 10 seconds.