How do you hide (empty) in Drop-down Search Fields of Data Grids

Since the upgrade from Mendix 7.23.19 to Mendix 8.17.1 the enumeration value (empty) appears in every Drop-down Search Field of all Data Grids. Is there a solution to hide the (empty) value?
1 answers

Hi Mats,

You can use the following JavaScript code with the HTML Snippet widget. Put this at the bottom of your page. 

mx.addOnLoad(function () {
    var searchDropDownList = document.querySelectorAll('.mx-grid-search-item select');
    for (var i = 0; i < searchDropDownList.length; i++) {
        // Get the ID from the parent parent
        var searchDropDownID = searchDropDownList[i];

        // Search for the option where the value ends on a _, that is the option value for (empty)
        var emptyOption = searchDropDownList[i].querySelector('[value=' + searchDropDownID + '_]');
        if (emptyOption) {

I’ve set the following options:

  • Refresh on context change: Yes
  • Refresh on context update: Yes
  • Enclose HTML with DIV: No


I’ve tested it in Studio Pro 8.12.5.