Hi
I've got a Webdatagrid which display 3 columns.
The grid uses the Filtering option with the Excel style filtering mode.
Everything is ok from this point of vue.
My question is quite simple:
When, I check one of the value the column filter 1 is providing, my grid is "filtered" and I can only see the rows containing the checked value. This is ok.
But, Now, if I open the column 2 filter, I can see all the values even those not belonging to the "filtered column 1" result.
So, is it possible to update the choice provided in a filtering list based on what is really display in the grid ?
Thanks
This is quite an emergency :)
Hello Nicolas,
If you would like have the custom values in the filtering list, you can handle PopulateUniqueFilterValues event on the server side and populate the list of your choice. The following forum thread has a code sample on how to handle this event and populate the list with custom values
http://www.infragistics.com/community/forums/p/76685/398899.aspx
Please let me know if you have any further questions regarding this matter.
well, I can handle things with what you said...
but, I must say that this is a pity that the actual behavior of the datagrid doesn't provide such an automatic update.
This is quite common to update and restrain a choice list when things are updated...
anyway, I hope this feature will be implemented by infragistics in a incoming release before my update time is over !
And I took a look at the link provided ==> is this a joke ? Are you a moron ?
No real clues are provided in the link...
What I want is : when a change the filter on a column, it makes data displayed change... so, I want the filtering choice list to be updated by the available values
currently displayed...
So, either you can provide a real answer, either you just can say: this can't be done or I don't have the real knowledge to give you any clues to achieve your goal.
Hello,
I was refering to the below code in the forum post which demonstrates how to populates the filterlist with custom values.
" protected Dictionary<string, List<object>> WebDataGrid1_PopulateUniqueFilterValues(object sender)
{
Dictionary<string, List<object>> filterDict = new Dictionary<string, List<object>>();
filterDict.Add("ID", new List<object>() { "1", "2", "3" });
filterDict.Add("FirstName", new List<object>() { "Jack", "Bob", "Steve" });
return filterDict;
}"
Currently it is not possible to update the filterlist based on the selection of other column filter list. If you would like to see this feature in future versions, you can suggest this product idea (or vote for existing ones) on our UserVoice website: http://ideas.infragistics.com/ There are many benefits to submitting an idea through UserVoice: - Communicate directly with our product management team. They'll see the idea described in your words and respond to you personally. - Receive notifications whenever new information regarding your idea becomes available. - Vote on your favorite product ideas to let us know which ones are the most important to you. - You and other developers can discuss existing product ideas with members of our Product Management team. The reason we ask you to submit this is it will allow you to more directly communicate with our Product Management team about your issue and concerns concerning the documentation.
Well
if someone needs the same as me, here is a piece of code to achieve so...
just call :
to Reset the filter, I just do :
Response.Redirect(Request.RawUrl);
protected Dictionary<string, List<object>> WebDataGrid1_PopulateUniqueFilterValues(object sender) { return GetGridFiltering(WebDataGrid1); }
public static Dictionary<string, List<object>> GetGridFiltering(WebDataGrid grid)
{ grid.Behaviors.Paging.Enabled = false; grid.DataBind();
foreach (GridRecord row in grid.Rows) { foreach (GridField col in grid.Columns) { string key = col.Header.FieldKey; if (!key.Contains("Unbound")) { //string text = row.Items[col.Header.Index].Text; string text = (row.DataItem as DataRowView)[key].ToString(); // on cherche les éléments qui existe uniquement dans la grille avec cette valeur... if (text != string.Empty) { if (filterDict.ContainsKey(key)) { // check if the value is already in if (!filterDict[key].Contains(text)) { filterDict[key].Add(text); } } else { List<object> myList = new List<object>(); myList.Add(row.Items[col.Header.Index].Text); filterDict.Add(key, myList); } } } } }
foreach (string k in filterDict.Keys) { filterDict[k].Sort(); }
grid.Behaviors.Paging.Enabled = true; grid.DataBind();
}