Skip to content

Commit

Permalink
Implemented layout.assignToolbar()
Browse files Browse the repository at this point in the history
  • Loading branch information
vitmalina committed Sep 19, 2015
1 parent 2e5a677 commit a8c3c1c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/w2layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* - $('#layout').w2layout() - if called w/o argument then it returns layout object
* - negative -size for left/right panels
* - sizeTo(..., instant) - added third argument
* - assignToolbar()
*
************************************************************************/

Expand Down Expand Up @@ -355,6 +356,25 @@
if (pan.show.toolbar) this.hideToolbar(panel); else this.showToolbar(panel);
},

assignToolbar: function (panel, toolbar) {
if (typeof toolbar == 'string' && w2ui[toolbar] != null) toolbar = w2ui[toolbar];
var pan = this.get(panel);
pan.toolbar = toolbar;
var tmp = $(this.box).find(panel +'> .w2ui-panel-toolbar');
if (pan.toolbar != null) {
if (tmp.find('[name='+ pan.toolbar.name +']').length === 0) {
tmp.w2render(pan.toolbar);
} else if (pan.toolbar != null) {
pan.toolbar.refresh();
}
this.showToolbar(panel);
this.refresh('main');
} else {
tmp.html('');
this.hideToolbar(panel);
}
},

hideTabs: function (panel) {
var pan = this.get(panel);
if (!pan) return;
Expand Down

0 comments on commit a8c3c1c

Please sign in to comment.