Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
515
Doubt regarding manual sorting , paging etc
posted

Hello everyone,

I have a doubt so when i am trying to perform manual sorting , filtering and paging its calling the same method specified in the datasourceurl. As they are calling same method now i m confused how to distinguish them in the method as when i write something for sorting its messing with the filtering code etc.Could you please help me out with this.

Code:

public JsonResult Data12()
{

var absolutepath1 = Request.QueryString.Value;
{
var absolutepath12 = Request.QueryString.Value;
NameValueCollection parse1 = HttpUtility.ParseQueryString(absolutepath12);
int skip = Convert.ToInt32(parse1["$skip"]);//number of rows to skip
int top = Convert.ToInt32(parse1["$top"]);// entries to be displayed
string s1 = parse1["$orderby"];
//TO PERFORM PAGING
if (skip != null && top != null && s1 == null || s1=="" )
{
IEnumerable<Student> s = data.paging(top, skip);

return Json(s);
}

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);


// IEnumerable<Student> students = data.GetStudents();

}

Parents
No Data
Reply
  • 740
    Offline posted

    Hello Rohit,

    I have been looking into your question and I wonder if you had the chance to review our Handling Remote Features Manually topic as well as the Handling Remote Features Manually sample?

    I am asking this question because the topic provides a detailed explanation along with code snippets demonstrating how each feature that has remote capabilities could be configured. Also, the sample provides a working demo as well as a code view section that allows you to see how the sample is actually configured.

    On my side, when testing the sample, the filtering, paging, and sorting features seem to be working accordingly and as expected when used individually or combined.

    Having this in mind, this may indicate that the described behavior is local to your own project configuration. However, as I am not sure of the overall configuration of your project and the sample seems to be working correctly, it is hard to tell what the possible reason for this behavior could be.

    Perhaps it may have something to do with the order of the filtering, sorting, and paging custom methods. This is just a simple guess as currently I do not have further information of your setup.

    Attached could be found a simplified version of the Handling Remote Features Manually sample where a great portion of the code configuration is taken directly from it.

    Please test it on your side and compare the different parts to your project.

    Additionally, in case you continue to experience this behavior, it would be helpful if you could provide me with a small, isolated sample that demonstrates the behavior on your side. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach it in this forum thread.

    Thank you for your cooperation.

    Sincerely,
    Riva Ivanova
    Associate Software Developer

    8787.Remote Fitering, Paging, Sorting jQuery.zip

Children
No Data