ParamQuery grid support forum
General Category => Help for ParamQuery Grid (free version) => Topic started by: precator on October 19, 2013, 12:01:32 am
-
I followed the remote sorting example but it doesnt seem to be hitting my Ajax Method. I am using MVC 4. This is what I have for my code. GridExample is my Controller and Paging is my ActionResult. Could anyone help me? The grid loads but no data is populating..
return {
url: "GridExample/Paging", data: "cur_page=" + this.curPage + "&records_per_page=" +
this.rPP + "&sortBy=" + sort[this.sortIndx] + "&dir=" + sortDir
};
-
Hi, can you post more code of your dataModel? I have some options for you to try:
1. Does your actionresult return json? return Json(result, JsonRequestBehavior.AllowGet);
2. Referring to the api:
getData: function( dataJSON, textStatus, jqXHR ){
return { curPage: dataJSON.curPage, totalRecords: dataJSON.totalRecords, data: dataJSON.data };
}
It needs a certain structure to work properly, it needs the current page, total records and your data. When directly accessing your GridExample/Paging method(http://localhost/GridExample/Paging?cur_page=1&records_per_page=10&sortBy=yourColumn&dir=down), do you have a simular structure as http://paramquery.com/demos/pagingGetOrders?cur_page=1&records_per_page=20&sortBy=orderID&dir=asc&_=1364228721972 (http://paramquery.com/demos/pagingGetOrders?cur_page=1&records_per_page=20&sortBy=orderID&dir=asc&_=1364228721972)?
Before returning data to your pqGrid by using getData function, you can always use 'console.log(dataJSON)' to check if the JSON object has data. In browser press F12 en go to console to see output. This may be even an easier to read option for checking data than going directly to url.
Please let me know if any of these options worked for you.