Arya220 Arya220 - 1 year ago 175
AngularJS Question

making row selection conditional in angular ui-grid

I am little new with angular Grids, sorry if it looks silly. Here is a link of plnkr which I have created.

My issues:

  1. I wanted to disable selction of those rows which has the property
    as false. As of now all are available for selection.

I tried to achieve the same by below code in

$scope.gridOptions.isRowSelectable = function(row){
return row.entity.IsApplicable;

But it did not seem to work.

  1. I wanted to give color to grouping Header and selection header.
    enter image description here

  2. I don't know if its possible, but it would have been good if I could make the width of first column("MetricName") as '0px'. As of now If I do that my group header also becomes '0px'. Because my first column is taking space, which is unused and I am forced to keep it because of group header.

Answer Source

Here is a plunker with 1+2

set this inside your gridOptions object (not after the api was registered)

isRowSelectable: function(row){
    return row.entity.IsApplicable;

and the column`s color is in simple css... i dont know if you can add a class to those cells, for that you need to do some digging in the angular grid api documentation

im not sure what you want to do in 3... if you are trying to keep the header without taking space in the columns that not possible... since this is a table if you have a header and the row`s column has an empty value it is still going to take the width of the column

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download