简体   繁体   中英

ng-grid how to style columns

I am a bit of an angularjs noob so here goes.
Trying out the ng-grid ( http://angular-ui.github.io/ng-grid/ ) and I am interested in the Excellike editing example (ref to plunker example: http://plnkr.co/edit/OxJqS5LYOvG2vx0Ujhu7?p=preview )

I could not figure out from reading the angulargrid documentation page how to style individual columns. What I would like to do is disable/enable a single column based on the value of another column in this grid. For example (does have any practical value but anyway) if in the plunker example the namecolumns starts with M the age column in that row should be disabled.

grid plunker example looks something like this:

Name | Age
Mark | 25 -> the age column should be disabled
Ed   | 31 -> the age column should be enabled

How can I set the style for an individual column based on the value of another one? Also how can I make the age field editable/noneditable (enabled/disabled) depending on the name column in that row?

from ColumnDefs Options

cellClass   ''  Appends a css class for the column cells    Link

for each column you can provide the cellClass.

along with that you can use the ng-class, if you want further control based on values in the row...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM