mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-31 01:34:09 +02:00
storage.js: Add method on
to StorageAwareSet
This commit is contained in:
parent
ffec2ebd4c
commit
3b7a1a5ab4
@ -22,12 +22,12 @@
|
|||||||
this.defaultVisibleRows = 2;
|
this.defaultVisibleRows = 2;
|
||||||
this.defaultVisibleHeight = 36;
|
this.defaultVisibleHeight = 36;
|
||||||
|
|
||||||
$(window).on('StorageAwareSetAdd', { self: this }, this.onExternalExpansion);
|
|
||||||
$(window).on('StorageAwareSetDelete', { self: this }, this.onExternalCollapse);
|
|
||||||
this.state = new Icinga.Storage.StorageAwareSet.withStorage(
|
this.state = new Icinga.Storage.StorageAwareSet.withStorage(
|
||||||
new Icinga.BehaviorStorage('collapsible'),
|
new Icinga.BehaviorStorage('collapsible'),
|
||||||
'expanded'
|
'expanded'
|
||||||
);
|
)
|
||||||
|
.on('add', { self: this }, this.onExternalExpansion)
|
||||||
|
.on('delete', { self: this }, this.onExternalCollapse);
|
||||||
};
|
};
|
||||||
Collapsible.prototype = new Icinga.EventListener();
|
Collapsible.prototype = new Icinga.EventListener();
|
||||||
|
|
||||||
|
@ -250,6 +250,27 @@
|
|||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register an event handler to handle storage updates
|
||||||
|
*
|
||||||
|
* Available events are: add, delete
|
||||||
|
*
|
||||||
|
* @param {string} event
|
||||||
|
* @param {object} data
|
||||||
|
* @param {function} handler
|
||||||
|
*
|
||||||
|
* @returns {this}
|
||||||
|
*/
|
||||||
|
on: function(event, data, handler) {
|
||||||
|
$(window).on(
|
||||||
|
'StorageAwareSet' + event.charAt(0).toUpperCase() + event.slice(1),
|
||||||
|
data,
|
||||||
|
handler
|
||||||
|
);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of (unique) elements in the set
|
* Return the number of (unique) elements in the set
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user