Adding row number to SC.TableView

I’m using the new SC.TableView from github.com/endash/endash

Add the following column.

      SC.TableColumn.create({
        key:   'dummy',
        title: 'Row',
        width: 50,
        isReorderable: NO,
        formatter: function(v, target) {
          return target.get('contentIndex') + 1;
        },
        exampleView: SC.TableCellContentView.extend({
          textAlign: SC.ALIGN_RIGHT,
          fontWeight: SC.BOLD_WEIGHT
        })
      })

Note that the key is set to a dummy property in your model that does not exist.

In the formatter method, I get the row index, add 1 and display it.

Leave a comment

0 Comments.

Leave a Reply


[ Ctrl + Enter ]