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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to set column filter on grid load

Thread ID:

Created:

Updated:

Platform:

Replies:

130961 Jun 13,2017 06:35 PM UTC Jun 14,2017 11:34 AM UTC JavaScript 2
loading
Tags: ejGrid
Adam Murray
Asked On June 13, 2017 06:35 PM UTC

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


Adam Murray
Replied On 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);
}

Mani Sankar Durai [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;