We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to set column filter on grid load

When a user clicks on a specific hyperlink I need to load a grid with all data for that member but immediatley filter by that specific category value. For example if user clicks on hyperlink for Purpose


Then the grid needs to default to Purpose category, however all other data must be loaded into the data source as well.


That way the user can then filter by any other option necessary


I tried using the data manager to filter locally but it removes unrelated data which is not what I want. I just want the grid to filter not the 

var gridObj = $("#pastVisitCommentsGrid").ejGrid("instance");

var filteredActiveData = ej.DataManager(gridObj.model.dataSource).executeLocal(ej.Query().where("CategoryName", ej.FilterOperators.equal, category, true));

gridObj.dataSource(filteredActiveData);


is there a way to set the default filter column when instantiating the grid?

Thanks, 
Adam


2 Replies

AM Adam Murray June 13, 2017 07:17 PM UTC

It seems it was always there as a method. Did the following and it works.

if (!ej.isNullOrUndefined(category) || category != "") {
var gridObj = $("#pastVisitCommentsGrid").ejGrid("instance");
// Sends a filtering request to the grid
gridObj.filterColumn("CategoryName", "equal", category, "and", true);
}


MS Mani Sankar Durai Syncfusion Team June 14, 2017 11:34 AM UTC

Hi Adam, 

Thanks for the update. 

We are happy to hear that your problem has been solved. Please let us know if you need further assistance. 

Regards, 
Manisankar Durai. 


Loader.
Up arrow icon