Search code examples
angular-ui-grid

Angular ui-grid: Additional Menu Button


Is it possible to add a second button directly below the menu button in ui-grid? I'd like to add a button with a custom function (to hide/show filters). I have a button that works, but I want it inside of the grid header row.


Solution

  • I did it using position: absolute to put the button in the top-left corner. You can do the same to put the icon in every fixed position, like under the menu button. The html is something like this:

    <div style="position: relative">
        <!-- ui-grid -->
        <div ui-grid="options" ui-grid-selection></div>
        <!-- filter button -->
        <div class="ui-grid-cell-contents" style="position: absolute; left: 0; top: 0;">
            <a href="#" ng-click="toggleFilters()"><!-- filter icon --></a>
        </div>
    </div>
    

    My result: screenshot