backgrid-grouped-columns
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -27,3 +27,2 @@ /* | ||
columnLayout: null, | ||
columnCollection: Backgrid.Columns, | ||
headerRows: [], | ||
@@ -73,3 +72,3 @@ | ||
var colNesting = (self.group) ? column.get("nesting") : []; | ||
var renderable = (typeof column.get("renderable") == "undefined" || column.get("renderable")); | ||
var renderable = (typeof column.get("renderable") === "undefined" || column.get("renderable")); | ||
if (colNesting && !_.isEmpty(colNesting) && renderable) { | ||
@@ -104,3 +103,7 @@ // Add index to colname for proper comparison for unique and different entries | ||
}, | ||
childColumns: [column.get("name")] | ||
childColumns: [{ | ||
name: column.get("name"), | ||
cid: column.cid, | ||
column: column | ||
}] | ||
}, columnJSON)); | ||
@@ -113,11 +116,14 @@ }); | ||
lastElement.attributes.colspan++; | ||
lastElement.childColumns.push(column.get("name")); | ||
lastElement.childColumns.push({ | ||
name: column.get("name"), | ||
cid: column.cid, | ||
column: column | ||
}); | ||
}); | ||
// Add main column | ||
rows[colNesting.length].push(_.extend({ | ||
attributes: { | ||
colspan: 1, | ||
rowspan: rowAmount - colNesting.length | ||
}}, column.toJSON())); | ||
rows[colNesting.length].push(column.set("attributes", { | ||
colspan: 1, | ||
rowspan: rowAmount - colNesting.length | ||
})); | ||
@@ -132,7 +138,6 @@ // Update nesting | ||
// Create column definition attributes and add to rows | ||
rows[0].push(_.extend({ | ||
attributes: { | ||
rows[0].push(column.set("attributes", { | ||
colspan: 1, | ||
rowspan: rowAmount | ||
}}, column.toJSON())); | ||
})); | ||
} | ||
@@ -151,2 +156,9 @@ }); | ||
}); | ||
// Set attributes. Loop cells of rows. | ||
_.each(self.headerRows, function(headerRow) { | ||
_.each(headerRow.cells, function(cell) { | ||
cell.$el.prop(cell.column.get("attributes")); | ||
}); | ||
}); | ||
@@ -205,2 +217,2 @@ // Attach row object to object to ensure compatibility with other plugins. | ||
}); | ||
})); | ||
})); |
{ | ||
"name": "backgrid-grouped-columns", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Backgrid.js extension for grouped columns.", | ||
@@ -5,0 +5,0 @@ "main": "backgrid-grouped-columns.js", |
@@ -7,3 +7,3 @@ # Backgrid.js - Grouped columns | ||
## Demo | ||
Online demo can be found [here](http://techwuppet.com/backgrid_poc_demo/) | ||
Online demo can be found [here](http://wridder.github.io/backgrid-demo/) | ||
@@ -10,0 +10,0 @@ ## Browser support (tested) |
24641
444