Lions Den

The Code and Times of Hanan Schwartzberg

About Hanan | Hanan's CV | Contact Hanan

December 5, 2015

Row numbering for ui-grid in Angular JS

Filed under: AngularJS,JavaScript — Tags: , , , — Hanan Schwartzberg @ 9:46 pm

The Issue

You want to display row numbers in a ui-grid. The numbers should should stay sequential regardless of the sorting

The Solution

Add this column to the grid’s columnDefs

{ name: 'rowNum', displayName: 'Row Number', cellTemplate: 
'<div class="ui-grid-cell-contents">{{grid.renderContainers.body.visibleRowCache.indexOf(row) + 1}}</div>' }

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Anti-Spam by WP-SpamShield

Home | Site Design | Banner Design | Code Den | Offsite Posts | Downloads | Photography | About Hanan | Hanan's CV | Contact Hanan
Copyright © 2009 Hanan Schwartzberg. All rights reserved.