Paging Action ver 7.403.0.20

I have two grids with relation master/slave (selecting data in master grid retrieves rows in slave grid).

First problem is:

When I want to hide column on master grid (using code shown below on main aspx page) everything works until i use paging action..




....
....
function hideColumn(gridName, colName) {
var gridObj = $find(gridName);
gridObj.hideColumn(colName);
}
...
...
After retrieving second page, previously hidden column is showing itself as a last column.



Second problem is:

How to retrieve rows (or invoke any other action) on slave grid (clear it when no row is selected), after invoking paging action on master grid.

Example of pagin action:

public ActionResult Load(PagingParams args)
{



IEnumerable data = _repository.GetAll(_dictContext.Nazwa, _dictContext.Nip).ToList();
ActionResult result = data.GridActions();
var engineSource = result as GridHtmlActionResult;


ViewData["Model"] = BuildGridModel();
return result;

}



1 Reply

BM Balaji M Syncfusion Team November 23, 2009 01:59 PM UTC

Hi Pawel,

Thank you for your interest in Syncfusion products.

1. When I want to hide column on master grid (using code shown below on main aspx page) everything works until i use paging action..

We suggest to use JQuery ajaxSuccess event to achive this column hiding in Master_Grid. This event used to attach a any function. This attached function will be executed whenever an AJAX request completes successfully.

Please refer the below syntax.

function (event, XMLHttpRequest, ajaxOptions) {
this; // dom element listening
}


Please refer the following code snippet to achive column hiding feature.

[js]
$("#Master_Grid").ajaxSuccess(function(event, XMLHttpRequest, ajaxOptions) {
var gridObj = $find("Master_Grid");
if (ajaxOptions.type == "post") {
//Hide the Master_Grid Column
hideColumn("Master_Grid", "CustomerID");
}
});


2. How to retrieve rows (or invoke any other action) on slave grid (clear it when no row is selected), after invoking paging action on master grid.

We can achieve this through JQuery ajaxSuccess event. Here i have created a simple sample to illustrates this feature.

Refer the below code snippet, which illustrates this.

$("#Master_Grid").ajaxSuccess(function(event, XMLHttpRequest, ajaxOptions) {
var gridObj = $find("Master_Grid");
if (ajaxOptions.type == "post") {
//Hide the Master_Grid Column
hideColumn("Master_Grid", "CustomerID");
//To call the slave grid.
$("#OrderID").val(0);
SubmitMvcAjaxForm("Child_form");
}
});

The sample illustrates,

1. Master_Grid contains the Order Information where as Child_Grid is contains the Order_details.
2. During the OnRecordSelect event the Child Table generates the corresponding order_details values in child Grid.
3. During the paging action, the child_grid cleared using .ajaxSuccess event.

Please refer the sample from the below link.
http://help.syncfusion.com/support/grid_mvc/v7.4.0.20/F91469/Sample.zip

Please let us know if you have any concerns.

Regards,
M. Balaji.

Loader.
Up arrow icon