PDA

View Full Version : [CLOSED] setValue for FilterHeader in code behind



HansWapenaar
Aug 04, 2014, 12:03 PM
Hi,

In the example http://examples2.ext.net/#/GridPanel/FilterHeader/Overview/ there is a button where a filter is set.
Is it possible to use setValues in the C# or VB code just like in this javascript code?

I tried somthing like the following code but no success:


protected void btnLoadFilter_Click(object sender, EventArgs e)
{
Dictionary<string, object> dict1 = new Dictionary<string, object>();
dict1.Add("Company", "!Inc.");
dict1.Add("Visible",1);
filterheader.SetValue(dict1);
filterheader.ApplyFilter();
}


May be my idea to get this done is too simple?

Purpose is to apply this in an application where I combined a Gridfilter with Infinite scrolling. Data come from a mySQL database table and is bound in the pageload. But it is also neccesary to insert records. After inserting a record and binding the data again the filter is cleared. So I want to re-apply the filter.

Hans

Vladimir
Aug 04, 2014, 12:24 PM
Hi

I tried your code snippet and it works for me. SetValue method works fine and ApplyFilter is not required in this case

HansWapenaar
Aug 04, 2014, 3:03 PM
Hi Vladimir,

You're right: it works.
Sorry, my mistake. Normally I add a click handler with:


<DirectEvents>
<Click OnEvent="btnLoadFilter_Click"></Click>
</DirectEvents>


But this time I took OnClick= "btnLoadFilter_Click" in the ext:Button.
That should be OnDirectClick.

The issue of getting the data filtered after inserting a new record and binding the data again could be implemented by adding


filterheader.ApplyFilter();


Thanks, Hans