backgrid-columnmanager
Advanced tools
Comparing version 0.2.0 to 0.2.1
{ | ||
"name": "backgrid-columnmanager", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A backgrid column manager. Adds the ability to show/hide columns.", | ||
@@ -5,0 +5,0 @@ "main": "lib/Backgrid.ColumnManager.js", |
# Backgrid.ColumnManager | ||
Manages the backgrid column collection. Adds the ability to toggle column visibility (initially and on the fly). | ||
Manages the backgrid column collection. Adds the ability to toggle column visibility (initially and on the fly) and is able to track, save and load state (width, order and visibility). | ||
[Online demo](https://wridder.github.io/backgrid-demo/) | ||
@@ -14,3 +14,7 @@ | ||
var colManager = new Backgrid.Extension.ColumnManager(columns, { | ||
initialColumnsVisible: 4 | ||
initialColumnsVisible: 4, | ||
// State settings | ||
saveState: true, | ||
loadStateOnInit: true | ||
}); | ||
@@ -33,2 +37,10 @@ | ||
$("#grid").append(grid.render().el); | ||
// Listen to state changes | ||
colManager.on("state-changed", function (state) { | ||
console.log("state changed: ", state); | ||
}); | ||
colManager.on("state-saved", function () { | ||
console.log("state saved!"); | ||
}); | ||
``` | ||
@@ -35,0 +47,0 @@ |
@@ -559,3 +559,3 @@ "use strict"; | ||
this.ItemView = (opts.DropdownItemView instanceof Backbone.View) ? opts.DropdownItemView : DropDownItemView; | ||
this.button = opts.button; | ||
this.$dropdownButton = opts.$dropdownButton; | ||
@@ -598,3 +598,3 @@ this.on("dropdown:opened", this.open, this); | ||
// Get button | ||
var $button = this.$el.parent().find(".dropdown-button").first(); | ||
var $button = this.$dropdownButton; | ||
@@ -754,2 +754,5 @@ // Align | ||
// Create button element | ||
this.$dropdownButton = $(this.options.buttonTemplate()); | ||
var viewOptions = { | ||
@@ -759,3 +762,4 @@ columnManager: this.columnManager, | ||
dropdownItemTemplate: this.options.dropdownItemTemplate, | ||
align: this.options.dropdownAlign | ||
align: this.options.dropdownAlign, | ||
$dropdownButton: this.$dropdownButton | ||
}; | ||
@@ -762,0 +766,0 @@ |
@@ -121,7 +121,9 @@ /*global jasmine, describe, beforeEach, it, expect, spyOn, Backgrid */ | ||
var nameCompare = function(a,b) { | ||
if (a.name < b.name) | ||
var nameCompare = function(a, b) { | ||
if (a.name < b.name) { | ||
return -1; | ||
if (a.name > b.name) | ||
} | ||
if (a.name > b.name) { | ||
return 1; | ||
} | ||
return 0; | ||
@@ -128,0 +130,0 @@ }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
327913
43
3960
48
0