- var view = panels[$('select', this.element.get(0)).val()];
- var klass = view.klass;
- console.log(view, klass);
- this.contentView = new klass($('.content-view', this.element.get(0)));
- console.log(this.contentView);
+ var value = $('select', this.element.get(0)).val();
+ var klass = panels[value];
+
+ if (this.contentView) {
+ this.contentView.dispose();
+ this.contentView = null;
+ }
+
+ if( value != 'empty') {
+ this.contentView = new klass($('.content-view',
+ this.element.get(0)), this.model.contentModels[value], this);
+ $('.panel-main-toolbar .refresh', this.element.get(0)).attr('disabled', null);
+ }
+ },
+
+ refreshButtonClicked: function(event) {
+ if (this.contentView) {
+ console.log('refreshButtonClicked');
+ this.contentView.reload();
+ }