Is there a way to remove empty option in the drop down filter field of Data grid?

0
I am looking for a solution to remove empty from the drop down filter field of Data grid mapped to an Enum attribute. The attribute is set with a default value. So, there is no need for an empty status for filter. I also read many posts on handling this by CSS. But i am afraid there is no option to configure a class name or style to the filter field. Any suggestions please?
asked
3 answers
3

Use this css snippet and apply the class to the drop-down

.empty-option-delete{ //removes an option in the subject selector.
   select
   {
      option[value=""]
      {
         display: none;
      }
   }
}

 

answered
2

If you are adding this filter inside the search bar of list/grid then you wont get option to apply any class.
In order to do this, you will have to move these filters out of the list/grid; for example in above case you can use Dropdown – Dynamic widget which will take grid entity and name as input and then set this enum as filter attribute and can even set class to it. 

answered
1

Usually you can use styling to block an option here. Here is a CSS example to create a class that blocks an option in a dropdown selector that has the value “DELETE_ACCOUNT”; I think you could create a similar class for this grid and apply it in the “appearance” tab. 

.no-account-delete{ //removes an option in the subject selector.
   select{
      option[value="DELETE_ACCOUNT"]{
         display: none;
      }
   }
}

This is a cosmetic fix, however. It would also be possible to use some JavaScript to actually remove that option from the DOM.

Hope this helps.

answered