1

I have a ui grid with set of rows in it and a button below that.I want to disable button when no row is relected and enable it if atleast one row is selected. Below is the plunker of ui grid

http://embed.plnkr.co/nAJ6h07ksn1MIYcHpQ0Q/

I tried to disable button this way

<input class="button" name="submit" type="button" value="Find Flights"
      ng-click="postdata()" ng-disabled="gridApi.grid.selection.selectedCount !== 0 ">

But this it is not getting enabled when a select a grid how can we achieve this

user7350714
  • 365
  • 1
  • 6
  • 20

1 Answers1

1

It should be the other way around. So when you select one item, then it should be enabled. So your condition should be ng-disabled="gridApi.grid.selection.selectedCount == 0 " which means none have been selected(so disable it).

<input class="button" name="submit" type="button" value="Find Flights"
      ng-click="postdata()" ng-disabled="gridApi.grid.selection.selectedCount == 0 ">
Vivz
  • 6,625
  • 2
  • 17
  • 33