PDA

View Full Version : YAHOO.ext.LayoutRegion enhancement.


Animal
11-08-2006, 05:16 AM
A LayoutRegion has a titleEl.

It's private, but it's a useful area. Currently, we can change the text.

It also has a div with class "ylayout-panel-hd-tools" which is where the collapse and close buttons are put.

Could this be exposed as a Toolbar?

I'd like to add operations. Like "Search". In my ListManager widget, the "north" region consists of filter tabs, and potentially a grid. At any point, I'd like to allow the user to go "OK, I like my filters. DO THE SEARCH"

So I don't want a lonely button inside each filter tab. I'd like to be able to use:


this.northRegion.getTitleToolbar().addButton({...});


On a related note. Can we insert ToolbarButtons into a ToolBar? We can't now, but I've added a function you might want to add:


YAHOO.ext.Toolbar.prototype.insertButton = function(index, config){
if(config instanceof Array){
var buttons = [];
for(var i = 0, len = config.length; i < len; i++) {
buttons.push(this.insertButton(index + i, config[i]));
}
return buttons;
}
var b = new YAHOO.ext.ToolbarButton(config);
var td = document.createElement('td');
var nextSibling = this.tr.childNodes[index];
if (nextSibling)
this.tr.insertBefore(td, nextSibling);
else
this.tr.appendChild(td);
b.init(td);
return b;
};


I know you're working incredibly hard Jack, and must be overwhelmed, so I'd like to enhance the ToolBar object.

I'd like to be able to test for the presence of ToolbarButtons in a ToolBar (probably by ID), and remove them (by id or index).

I'll follow up with some code.

Animal
11-08-2006, 05:36 AM
Well, it's easy for me to do, so no hurry on exposing a ToolBar:


this.searchButton = this.listRegion.createTool(this.listRegion.tools.dom, 'search-button');
this.searchButton.dom.title = "Start search";
this.searchButton.on("click", this.createListFromFilters, this, true);


It's just that "createTool()" seems to duplicate Toolbar's addButton() functionality, so I think a Toolbar instance exposed by getToolBar() would be desirable in the medium term.

jack.slocum
11-08-2006, 07:54 AM
I agree a toolbar would be useful. The 2 main problems are CSS collisions (this could easily be fixed with a little time) and size. Toolbar buttons are just too big (16px + 2px margin) for that tiny title area. With the CSS changes though, they could be adjusted smaller. I will look at adding it.

By the way, those dialogs look pretty sweet with a layout embedded.

jack.slocum
11-08-2006, 07:57 AM
I also added that function in. Thanks for sharing.