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

updated rowTemplate example

Open mxreppy opened this issue 13 years ago • 4 comments

I've been trying to work with the rowTemplate example and the current grid code (I believe some of the 2.0.x changes have broken it), but can't get it to work

This plunkr

http://plnkr.co/edit/nXBb7sPLkYhmE5N6Q7P6?p=preview

is a copy of the row template plunkr linked where I've copied in the rowTemplate partial from the current source, and attempted to merge in the conditional class setting, but I think the two ng-class directives are fighting. Can someone who knows more about Angular or the grid help me out here?

thanks!

mxreppy avatar Apr 12 '13 15:04 mxreppy

Doen't appear multiple expressions are doable right now, but a fix would be to move the first ng-class to the class attribute. YMMV

var rowTempl = '<div ng-style="{ \'cursor\': row.cursor }" '+ 
'ng-repeat="col in renderedColumns" '+
'ng-class="{green: row.getProperty(\'age\')  < 30}"' + 
'class="ngCell {{col.cellClass}} {{col.colIndex()}}" ng-cell></div>';

specialjyo avatar Apr 16 '13 16:04 specialjyo

Thanks, that appears to work fine for me. I appreciate the help.

Can I mark this issue as FAQ/documentation? Or does that need to be an admin.
Could someone update the plunkr link from the examples page?

mxreppy avatar Apr 16 '13 17:04 mxreppy

This is an angular limitation, you can't have multiple ng-class tags in a div

orneryd avatar Apr 16 '13 21:04 orneryd

Ng-class supports multiple expressions , ng-grid has its ng-class on the row in such a way the multiple expressions break the grid. I'm not sure why ng-class is being used , which is why I moved that class in my example solution.

specialjyo avatar Apr 16 '13 22:04 specialjyo