'How do I use jqgrid free with ajax?
I want to display a grid of data. I'm using ASP.NET MVC.
I could just write some less than great code to loop through my view model and create a javascript string, something like:
var data = "[";
@foreach (var item in Model.items} {
<text>"{ Name: " + item.Name + "},";</text>
}
data += "]";
// outputs several lines of javascript to build up a data object that I can feed into jqgrid
However to avoid this I figure, why not just put the data into an ajax method? I have seen other questions floating around suggesting that you can use data: <ajax command of some sort> but the documentation has absolutely nothing on how to do this.
I am wondering if it's possible, and if so, what format should the return json be in in order to be used by the jqgrid free?
Solution 1:[1]
To load data with ajax you can use option url, and to add/edit/delete data you can use option editurl.
Example:
$("#grid").jqGrid({
url: '/your-url',
editurl: '/your-edit-url'
...
}
Note: free-jqgrid is based on jqGrid. free-jqGrid is not fully documented but you can find help in older documentation of jqGrid.
For most of the options you will find documentation in:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
