...
|
...
|
@@ -18,6 +18,18 @@ tab.prototype = { |
|
|
var g = this,
|
|
|
p = this.options;
|
|
|
$(this.tab).html("");
|
|
|
|
|
|
|
|
|
var pattern = /tab=.*?(?=&&)/gi,
|
|
|
tab = null,
|
|
|
index = null;
|
|
|
|
|
|
|
|
|
if (location.hash != '') {
|
|
|
tab = pattern.exec(location.hash)[0];
|
|
|
index = tab.split('=')[1];
|
|
|
}
|
|
|
g.index = index;
|
|
|
this.render(data);
|
|
|
this.bind(p.click);
|
|
|
return this;
|
...
|
...
|
@@ -25,13 +37,13 @@ tab.prototype = { |
|
|
bind: function(callback) {
|
|
|
var g = this,
|
|
|
p = this.options;
|
|
|
|
|
|
$(p.el).off("click", "li");
|
|
|
$(p.el).on("click", "li", function() {
|
|
|
$(this).addClass('active').siblings().removeClass('active');
|
|
|
g.active = $(this).find("a").attr("columnname");
|
|
|
g.key = $(this).find("a").attr("key");
|
|
|
g.value = $(this).find("a").attr("value");
|
|
|
location.hash = location.hash + 'tab=' + $(this).index();
|
|
|
callback && callback.call(this);
|
|
|
});
|
|
|
},
|
...
|
...
|
@@ -44,9 +56,11 @@ tab.prototype = { |
|
|
var li = $("<li></li>");
|
|
|
var a = $("<a href='javascript:void(0);'></a>");
|
|
|
|
|
|
if (column.name == 'all') {
|
|
|
if (g.index && i == g.index) {
|
|
|
li = $('<li class="active"></li>');
|
|
|
} else if (!g.index && column.name == 'all') {
|
|
|
li = $('<li class="active"></li>');
|
|
|
};
|
|
|
}
|
|
|
if (column.name) a.attr({
|
|
|
columnname: column.name
|
|
|
});
|
...
|
...
|
|