Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

ASPxGridView - How to hide or show filter row menu items for a certain column

$
0
0

This example demonstrates how to hide or show filter row menu items for a certain column.


To do this, we assign CSS classes to:

- Filter cells using the Styles.FilterCell.CssClass property;

- Filter row menu items using the Styles.FilterRowMenuItem.CssClass property;

- Specific column's filter cell using the GridViewDataColumn.FilterCellStyle.CssClass property;


These classes will be used later to find the necessary elements. In addition, the ASPxGlobalEvents control is used to attach client events to those elements:

[JScript]
var textContentProp = null;function OnPageReady(s, e){ textContentProp = "innerText"in document.body ? "innerText" : "textContent";var elements = document.getElementsByClassName("filterCell");for(var i = 0; i < elements.length; i++){ ASPxClientUtils.AttachEventToElement(elements[i], "click", function(event){var hide = event.currentTarget.className.indexOf("necessaryColumn")> 0 ? false : true; ManageOptions(hide);});}}function ManageOptions(visible){var value = visible ? "list-item" : "none";var options = document.getElementsByClassName("frmi");for(var i = 0; i < options.length; i++){var option = options[i];var text = option[textContentProp].toLowerCase();if(text.indexOf("equals")>= 0 || text.indexOf("is less than")>= 0) option.style["display"] = value;}}
The element's "display" style is changed based on specific conditions.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>