Grid Sorting/Paging Action

Hello, I've read in old posts that it was possible to set Sorting/Paging controller actions using a PagingSortingMapper property in GridPropertiesModel. However, I can't find this property in an example that I'm developing. Is this property deprecated? Is it defined in an assembly that I forgot to reference? How could I have to grids in the same view, and get each one controlled by different actions?

I'm using an evaluation copy of assemblies.

Thank you.


9 Replies

ES Eswari S Syncfusion Team March 25, 2011 07:40 AM UTC

Hi Sergio,

Thank you for your interest in Syncfusion products.

In our earlier version, we have used GridPropertiesModel for Paging/Sorting. But in latest version 9.1 ,we can achieve the Paging/Sorting using GridBuilder. However We have prepared the sample for Grid Paging/Sorting using both GridPropertiesModel and GridBuilder. Please find the sample from the attachment.


1.Paging using GridPropertiesModel:

we can achieve the Paging/Sorting using GridPropertiesModel.Please refer the below code snippets.

[Controller]

public ActionResult FlatGrid( )
{
GridPropertiesModel gridModel = new GridPropertiesModel()
{
DataSource = new NorthwindDataContext().Orders,
AllowPaging=true,
AllowSorting=true,
Caption = "GridOrders"

};
ViewData["GridModel"] = gridModel;
return View(this.ViewData);
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult FlatGrid(PagingParams args)
{
var data = new NorthwindDataContext().Orders.ToList();
return data.GridActions();
}

2.Paging using GridBuilder:

we can achieve the Paging/Sorting by calling the post action method in controller. Please refer the below code snippets.

[Controller]

public ActionResult ServerPaging()
{
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return View(data);
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ServerPaging(PagingParams args)
{
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return data.GridActions();
}

In ASPX page we have to call the EnablePaging/EnableSorting methods.

[ASPX]

<%=Html.Syncfusion().Grid("OrderGrid")

.Column(column => {
column.Add(p => p.UniversityCode).HeaderText("University Code");
column.Add(p => p.Title);
})
.EnablePaging()
.EnableSorting()

%>

Please let us know if you need further assistance.

Regards,
Eswari.S




Grid Paging_72b7692a.zip


SE Sergio Escalada March 25, 2011 08:50 AM UTC

Thanks for response, Eswari, but it isn't exactly what I asked. I have not explained it very well, sorry...

With PagingSortingMapper property, it seems that it was possible to do things like the following code.

[Controller]
public ActionResult Index( )
{
// ...
// some code

GridPropertiesModel gridModel = new GridPropertiesModel()
{
// ...
// some code
PagingSortingMapper = "LoadGridAction",
// ...
// some code
};

// ...
// some code
}

// Action with a custom name to control the grid
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult LoadGridAction(PagingParams args)
{
// ...
// some code to control paging, sorting
}


With current assemblies, I can't see this property anywhere. How can I do it now?



ES Eswari S Syncfusion Team March 29, 2011 07:15 AM UTC

Hi Sergio,

In latest version 9.1 , we have removed the PagingSortingMapper Property. We have modified the Paging/Sorting using GridBuilder. Now we can achieve the paging action through same action. Here we have used the ServerPaging action.

public ActionResult ServerPaging() {
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return View(data);
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult ServerPaging(PagingParams args) {
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return data.GridActions();
}
However, if you want to use Custom action, then you can use this below mentioned method to achieve your requirement.

public ActionResult ServerPaging()
{
IEnumerable data = new StudentDataContext().Student.ToList();
return View(data);
}

[AcceptVerbs(HttpVerbs.Post)]

[ActionName("ServerPaging")]

public ActionResult CustomAction(PagingParams args)
{
IEnumerable data = new StudentDataContext().Student.ToList();
return data.GridJSONActions();
}

Please let us know if you need any further assistance.

Regards,
Eswari.S





SE Sergio Escalada March 29, 2011 07:30 AM UTC

Ok, so how can I get two different grids running on the same view? We want to use master-detail interfaces. In details section, we can have an undetermined number of grids, an we need a different POST action for each one of them.

Thanks.



SR Solaiappan R Syncfusion Team March 29, 2011 03:34 PM UTC

Hi Sergio,

We deeply regret for the inconveniance caused.

In 7.4.0.15 version, PagingSortingMapper, GroupingMapper, JSONModePagingSortingMapper properties are removed to avoid overhead of maintaining separate action result for GridAction. But as per your request we have planned to provide you the requested feature in an efficient manner with optional arguments like Controller name, Action name and Route values for the ActionMapper. Hence, we have logged a feature request and it will be available in our upcoming volume release which is scheduled on first week of May 2011. We will let you know once this feature is implemented.

we do not provide confidential information in the general forum, so we have internally created incident(ID - 78854) for this future.You can follow up with the incident for frequent updates.

Please let us know if you need any further assistance.

Regards,
R. Solaiappan.



MW Martin White September 3, 2011 11:02 AM UTC

Did this release happen? I need the same features that he does - I have a single grid that is being used to show the results of different queries, some filtered, some not. I used the old attribute to control which method was called to refill the grid with data after a search, and this functionality is now gone.



ES Eswari S Syncfusion Team September 6, 2011 04:47 AM UTC

Hi Martin,

We have included the feature "Action Mapper" identified in this forum in our Essential Studio Vol 2 2 release and you can download the latest release under the following link.

http://www.syncfusion.com/support/forums/general/100432/Essential-Studio-2011-Volume-3-Final-Release-v93061-available-for-download

Please follow the below code to implement the Action mapper. Shortly We will update the UG document in online.

Step #1: [Aspx]

<%=Html.Syncfusion().Grid("Paging_Grid")
.Datasource(Model)
.Caption("Order Details")

.Column(column =>
{
column.Add(p => p.OrderID).HeaderText("OrderID");
column.Add(P => P.CustomerID);
column.Add(p => p.Freight);
})

.EnablePaging()
.EnableSorting()
.EnableFiltering()
.EnableGrouping()

.Mappers(map=>map.Action("CustomMapper")) //Custom Mapper

%>

Step #2:[Controller]

public ActionResult ServerPaging()
{
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return View(data);

}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult CustomMapper(PagingParams args)
{
IEnumerable data = new NorthwindDataContext().Orders.ToList();
return data.GridActions();

}

We have prepared the sample for your reference and the same can be downloaded from the following link.

Sample1110460619.zip

Note: If you want to run the sample in MVC3, change the configuration manager as Debug_MVC3/Release_MVC3.To briefly know about that steps please kindly refer this document link.

How to Switch between MVC2 to MVC3

Please try this and let us know if you need any further assistance.

Regards,
Eswari.S







TO Tolulope replied to Solaiappan R February 5, 2018 06:35 PM UTC

Hi Sergio,

We deeply regret for the inconveniance caused.

In 7.4.0.15 version, PagingSortingMapper, GroupingMapper, JSONModePagingSortingMapper properties are removed to avoid overhead of maintaining separate action result for GridAction. But as per your request we have planned to provide you the requested feature in an efficient manner with optional arguments like Controller name, Action name and Route values for the ActionMapper. Hence, we have logged a feature request and it will be available in our upcoming volume release which is scheduled on first week of May 2011. We will let you know once this feature is implemented.

we do not provide confidential information in the general forum, so we have internally created incident(ID - 78854) for this future.You can follow up with the incident for frequent updates.

Please let us know if you need any further assistance.

Regards,
R. Solaiappan.


what controls do you have for Xamarin.Form Applications?


VM Vijayakumar Mariappan Syncfusion Team February 6, 2018 01:58 PM UTC

Hi,
 
You can find the list of our available controls and its features under the below link.  

 
You can find more details about how to work with our controls on the below link.  
  
Please get back to us if you need any assistance on working with our controls. 
 
 
Regards, 
Vijay M 


Loader.
Up arrow icon