Reputation: 356
I have jqGrid in place
@(Html.Grid("Basic")
.SetCaption("Basic Grid")
.AddColumn(new Column("Id")
.SetHidden(true))
.AddColumn(new Column("Name"))
.AddColumn(new Column("Age").SetFormatter(Formatters.Integer))
.SetForceFit(true)
.SetShrinkToFit(true)
.SetAutoWidth(true)
.SetRowNum(10)
.SetRowList(new[] { 10, 15, 20 })
.SetViewRecords(true)
.SetPager("pager")
.SetLoadOnce(true)
.SetGridView(true)
.SetToolbarPosition(ToolbarPosition.Top)
.OnGridComplete("onComplete()")
)
And to make dataType local I setup an ajax call separately and grid binded successfully but what happening wrong is the integer column "in my case Age' is not sorting properly. What I suppose to do to sort it right?
$.ajax({
type: "GET",
url: "/Home/Data/",
dataType: "json",
success: function (data) {
var jsonData= data;
$("#Basic").jqGrid('setGridParam',
{
datatype: 'local',
data: jsonData
}).trigger("reloadGrid");
},
error:function () {
}
});
Upvotes: 1
Views: 194
Reputation: 392
There is a property called sorttype, You could try this,
sorttype : 'int' or 'integer'
Refer the below wiki link,
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
Upvotes: 1