angularjsangular-ui-gridangularjs-filter

uigrid remove initial blank option from dropdown filter


Here's the screenshot of my ui-grid.

enter image description here


Here's the code that creates that filter.

{ field: 'channel_type', displayName: "Type", filter: {
                                        type: uiGridConstants.filter.SELECT,
                                        selectOptions: [
                                            { value: 'HD', label: 'HD' },
                                            { value: 'SD', label: 'SD' }
                                        ]
                                    }},
            { field: 'price', displayName: "Price", enableFiltering: false, enableSorting: false},


My data is loaded in uigrid from rest api call.

I really can't figure it out from where is it adding that blank option. I haven't found any solution to this issue. Please help me in solving this problem.


Solution

  • Its a known issue, see ui-grid issues

    The solution (workaround) is to add some custom style:

    #grid1 div div select option:first-child[value=""] {
       display: none;
    }
    

    Demo Plunker