1

I am trying to use gridApi.grid.selection.selectAll option to check/select 'selectAll' checkbox in uiGrid header programmatically. But it throws the below error:

Property 'selection' does not exist on type 'IGridInstanceOf'.

I am using angular ui-grid typings file and I don't find the 'selectAll' option in the file. Is there any workaround for this issue?

Olive
  • 21
  • 3

1 Answers1

1

The correct call would be:

gridApi.selection.selectAllRows

gridApi.grid doesn't have the "selection" method:

enter image description here

On the other hand, gridApi.selection has:

enter image description here

For reference: http://ui-grid.info/docs/#!/api/ui.grid.selection.api:PublicApi

Edit #1

To desselect the rows, you can use:

gridApi.selection.clearSelectedRows(); //For all rows
gridApi.selection.unSelectRow(rowEntity); //For one row (You need to pass the rowEntity)
stLmpp
  • 61
  • 2
  • 4
  • 1
    gridApi.selection.selectAllRows() works to select the 'select All' checkbox programatically. Is there anyway to uncheck it? – Olive Jul 05 '19 at 04:29
  • I tried using gridApi.selection.unSelectRow(rowEntity). It unselected that row but did not clear the 'select All' checkbox. – Olive Jul 07 '19 at 16:55
  • Well, that will depend on what you're using as model on your "select all" checkbox Can you provide some code? – stLmpp Jul 11 '19 at 00:42