Hello everyone ,
So , i was performing manual paging but i passed skip and top parameter and using stored procedure returning the records.But its only showing page 1 and top records specified next and previous page options are disabled. Could you please help me and let me know what i am doing wrong?
Code:
dataSourceUrl: "/Student/Data12", dataSource: "/Student/Data", responseDataKey: "Records", features: [ { name: "Selection", mode: "row", multipleSelection: true }, { name: "RowSelectors", enableCheckBoxes: true, enableRowNumbering: true }, { name: "GroupBy" }, { name :"Paging", type:"remote", pageSize: 7, visiblePageCount:5, recordCountKey: "TotalRecordsCount" },
CONTROLLER:
public IActionResult Index(){
var absolutepath1 = Request.QueryString.Value; Console.WriteLine(absolutepath1); return View();}
public JsonResult Data(){
// var absolutepath = HttpUtility.ParseQueryString(HttpContext.Request.QueryString.ToString()) ; var absolutepath1 = Request.QueryString.Value; NameValueCollection parse1 = HttpUtility.ParseQueryString(absolutepath1); int skip = Convert.ToInt32(parse1["$skip"]);//number of rows to skip int top =Convert.ToInt32(parse1["$top"]);// entries to be displayed Console.WriteLine(skip.GetType()); if(skip!=null && top != null){ IEnumerable<Student> s = data.paging(top, skip); return Json(s); }
//to check query string parameter for paging
//Console.WriteLine(parse1 +"hi"); //foreach(string keys in parse1.Keys) //{ // Console.WriteLine(keys + ":" + parse1[keys]); //}
// dynamic p = Request.GetDisplayUrl();
// Console.WriteLine(absolutepath);
IEnumerable<Student> students = data.GetStudents();
return Json(students);
}
//UPDATE URL OR SORTING AND OTHER OPERATIONSpublic JsonResult Data12(){
var absolutepath1 = Request.QueryString.Value; { var absolutepath12 = Request.QueryString.Value; NameValueCollection parse1 = HttpUtility.ParseQueryString(absolutepath12); Console.WriteLine(parse1 + "hi"); foreach (string keys in parse1.Keys) { Console.WriteLine(keys + ":" + parse1[keys]); } } var absolutepath = HttpContext.Request.Query["$orderby"].ToString(); Console.WriteLine(absolutepath1); Console.WriteLine(); // string? a= HttpUtility.UrlDecode(absolutepath1); // NameValueCollection parameters = System.Web.HttpUtility.ParseQueryString(a); string filter = ApplyFilterExpr(absolutepath1); Console.WriteLine("filter" + " " + filter);
IEnumerable<Student> sat= data.filter(filter);
if (absolutepath!="") { // Code inside the if block string[] m = absolutepath.Split(' '); Console.WriteLine("hi");
var colname = m[0]; // to get col name
var orderb1y = m[1];// top get orderby
sat = data.sort(colname, orderb1y); } // sat is not accessible here outside the if block return Json(sat);
So , then data method runs when the grid is loaded first time and when you make any changes like manual sorting or filtering etc the method specified in the datasourceurl runs i.r data12() method.
Hello Rohit,
I have been looking into your question and I have noticed that a similar one regarding the igGridPaging remote capability has already been asked in the following forum post here where I have already provided an answer along with a test sample.
As the isolated sample seems to be working correctly and cannot reproduce the described behavior, this may indicate that the issues are local to your own project configuration. If only the first page is displayed and the "Next" and "Prev" buttons are disabled, this means that all records from the igGrid’s data are currently displayed. If this is not the case and there are more records to be displayed, please test the provided sample on your side and make sure that your custom configuration is in a similar manner to the provided one.
Additionally, please note that according to our support policy we handle a single thread per issue. This is for better history tracking and helps us ensure that all issues are addressed and handled correctly.
Having this in mind, I would suggest addressing your questions regarding the igGridPaging feature’s remote capabilities in the original forum post.
Lastly, I would like to mention that when creating a forum post and/or having follow-up question, it would be highly appreciated and helpful if you could attach code snippets/samples with configurations that are relevant to your query.
For example, having testing and commented code:
Rohit Rawat said://Console.WriteLine(parse1 +"hi"); //foreach(string keys in parse1.Keys) //{ // Console.WriteLine(keys + ":" + parse1[keys]); //}// dynamic p = Request.GetDisplayUrl(); // Console.WriteLine(absolutepath);
or code that includes custom functionality that cannot be identified in the overall functionality:
Rohit Rawat said:IEnumerable<Student> students = data.GetStudents();
makes it harder to identify a certain unwanted behavior and is not as straightforward as copying and pasting the code for testing purposes.
Thank you for your cooperation.
Sincerely, Riva Ivanova Associate Software Developer