ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

In contrast to #2170 , how to enable/disable(show hide) Selection column dynamically

Open sahil-kapoor opened this issue 12 years ago • 8 comments

How should i show or hide the selection column dynamically ie on a button click? I cant set the $scope.gridOption.enableRowHeaderSelection= false on the button click. I can hide the coloumn by hiding it or setting the visibilty to false by the api. Is there any way to hide/show the selection column through api not through grid option?

sahil-kapoor avatar Nov 21 '14 06:11 sahil-kapoor

I'm not clear on your question. When you say you can't set $scope.gridOption.enableRowHeaderSelection= false on a button click, does that mean you need advice on how to set it, or does it mean you're setting it and then it's not doing what you'd expect?

There is no api other than the gridOption (which is itself an API), but it may be that we need to make that option dynamic, so this would be another variant of #1819

PaulL1 avatar Nov 22 '14 00:11 PaulL1

Please have a look at http://plnkr.co/edit/e0TxTvCXRRp4cqggoHGd?p=preview What i am trying to do is, when someone clicks on the button , selection column should toggle between show and hide or the selection column check boxes should be enabled or disabled for the whole grid.

sahil-kapoor avatar Nov 24 '14 10:11 sahil-kapoor

Right now grid options like that are not being watched for updates, I don't think. That's someone that's been discussed but I don't think we've landed on a consensus.

I'm going to mark this as an enhancement, and it's probably something we need to address.

c0bra avatar Dec 08 '14 18:12 c0bra

I believe this has now been addressed, selection can be turned on and off.

PaulL1 avatar May 27 '15 06:05 PaulL1

Having the same issue and can confirm this has not been addressed yet, at least as far as I can tell. Initially: $scope.gridOptions.enableRowHeaderSelection = false; Then on button click: $scope.gridOptions.enableRowHeaderSelection = true;

However the UI doesn't update even after grid.refresh(); and notifyDataChange.

PeterRangelov-zz avatar Dec 15 '17 00:12 PeterRangelov-zz

I have exactly the same issue. Any workaround ?

chandruk4321 avatar Jan 31 '18 19:01 chandruk4321

It seems there is still not an option to show/hide the row headers columns.

The work around we use it to show/hide the checkboxes by adding/removing a disable-row-selection class to the ui-grid:

.ui-grid.disable-row-selection {
  .ui-grid-selection-row-header-buttons {
    display: none;
  }
}

tomyam1 avatar Jul 11 '18 14:07 tomyam1

I'm not clear on your question. When you say you can't set $scope.gridOption.enableRowHeaderSelection= false on a button click, does that mean you need advice on how to set it, or does it mean you're setting it and then it's not doing what you'd expect?

There is no api other than the gridOption (which is itself an API), but it may be that we need to make that option dynamic, so this would be another variant of #1819

Thanks its working fine

cscuser avatar May 12 '21 11:05 cscuser