Hi,
I have a requirement to create a custom filter for my WebDataGrid/WebHierarchicalDataGrid. In order to do so, I've added the following code inside WebHierarchicalDataGrid1_Filtering_FilterDropdownDisplaying client event to display a WebDialogWindow and do my custom filter logic whenever user clicks on filter icon from the grid's columns:
function WebHierarchicalDataGrid1_Filtering_FilterDropdownDisplaying(sender, eventArgs) { ///<summary> /// ///</summary> ///<param name="sender" type="Infragistics.Web.UI.WebHierarchicalDataGrid"></param> ///<param name="eventArgs" type="Infragistics.Web.UI.CancelDropDownEventArgs"></param>
//Add code to handle your event here. oWebDialogWindow1 = $find('<%=wdwFilter.ClientID %>'); if (oWebDialogWindow1 != null) { oWebDialogWindow1.set_windowState($IG.DialogWindowState.Normal); eventArgs.set_cancel(true); } }
My question is, is it possible to get the selected column key in above mentioned client event?
For example, if a user would like to filter column A, I need to retrieve the column key for column A inside WebHierarchicalDataGrid1_Filtering_FilterDropdownDisplaying client event.
Any help is appreciated!
Thanks!
Hi Nazmi,
One way to get the key is off the eventArgs as follows: eventArgs.get_source().parentElement._object.get_column().get_key()
...
As a note, this suggested solution uses an internal private field (._object) which is generally not recommended as internal private fields are fair game to be changed in source code without notice. But this approach will enable you to accomplish your objective.
function WebHierarchicalDataGrid1_Filtering_FilterDropdownDisplaying(sender, eventArgs)
{
oWebDialogWindow1 = $find('<%=wdwFilter.ClientID %>');
if (oWebDialogWindow1 != null) {
oWebDialogWindow1.set_windowState($IG.DialogWindowState.Normal);
eventArgs.set_cancel(true);
}
var key = eventArgs.get_source().parentElement._object.get_column().get_key()
Please let me know if you need any additional assistance regarding this matter.
Hello Troy,
It does help me to achieve my objective. Thanks for your help!