Permalink
Browse files

[enh] id creation added

  • Loading branch information...
1 parent 2c09911 commit 21fc84803e28e86f2c3820e66ea51e91e73e2d08 @asciimoo asciimoo committed May 13, 2012
Showing with 13 additions and 0 deletions.
  1. +13 −0 scraptils/datainspector/templates/data.html
View
13 scraptils/datainspector/templates/data.html
@@ -130,7 +130,20 @@
}
$(function () {
+ var has_id = false;
+ for(k in columns) {
+ if(columns[k].id == 'id') {
+ has_id = true;
+ break;
+ }
+ }
data = {{ data|safe }};
+ if(!has_id) {
+ columns.push({id: 'id', field: 'id', name: 'id', sortable: true})
+ for(k in data) {
+ data[k].id = k+1;
+ }
+ }
dataView = new Slick.Data.DataView({ inlineFilters: true });
grid = new Slick.Grid("#grid", dataView, columns, options);

0 comments on commit 21fc848

Please sign in to comment.