30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
(function ($) {
|
|
$.fn.scenarioDetailsGrid = function (options) {
|
|
// plugin settings
|
|
this.$settings = $.extend({
|
|
// These are the defaults.
|
|
className: "clpsd" //collapsed CSS class name which will be assigned to the column
|
|
}, options);
|
|
|
|
// methods
|
|
this.initPlugin = function () {
|
|
this.$container = this.find('div.fixedTable');
|
|
var anchor = this.$container.find('table thead tr th a.clpsd-btn');
|
|
anchor.parent().css('cursor', 'pointer').on('click', $.proxy(this.toggle, this));
|
|
return this;
|
|
};
|
|
this.toggle = function () {
|
|
var className = this.$settings.className;
|
|
if (this.$container.hasClass(className)) {
|
|
this.$container.removeClass(className);
|
|
} else {
|
|
this.$container.addClass(className);
|
|
}
|
|
};
|
|
|
|
// init plugin
|
|
this.initPlugin();
|
|
// return plugin object
|
|
return this;
|
|
};
|
|
}(jQuery)); |