Search Engine: Elastic

Article ID: 120123, created on Feb 14, 2014, last review on May 3, 2014

  • Applies to:
  • APS 2.x


I use an 'aps/Grid' widget together with a toolbar. I would like buttons in this toolbar to only be enabled if some rows are selected in my grid. If no rows are selected, buttons should be disabled. How can I do this?


You can use the 'requireSingleItem' or 'requireItems' properties. Enabling these at grid declaration makes the toolbar buttons inactive unless one (in case of 'requireSingleItems') or more items are selected in the grid.

Details are available in aps/Grid specification.

You can also make the buttons disabled by default and then monitor the selectionArray property of the grid which stores the selected rows. If this array is empty (i.e. nothing is selected) the buttons should be disabled. If the array is not empty, they should be enabled. For example, if grid is saved in 'grid' variable, the code can look like this:

    this.length ? [enable buttons] : [disable buttons];

Replace [enable buttons] and [disable buttons] with proper code that would enable or disable your buttons. This second method will work if you declare your toolbar buttons programmatically and outside of the grid object after the grid is created.

70bf700e0cdb9d7211df2595ef7276ab 717db81efe94e616312b74fb03a5d474

Email subscription for changes to this article
Save as PDF