PDA

View Full Version : Add an option to abbreviate long tab titles but not region titles


seade
08-12-2007, 10:10 PM
This is a suggestion/feature request.

I am adding a small number of ContentPanels to the "center" region of a BorderLayout which as desired results in them being presented as a series of tabs. By assigning no title to the LayoutRegion the tab text of the ContentPanels is used instead and updates whenever a new tab is selected. Now because I have one particular tab whose title can be of a reasonably arbitrary length, say < 128 chars, I currently use Ext.util.Format.ellipsis() to trim this down to 35 characters. This means however that when the tab text is used for the region title, it too is abbreviated.

It would be great if the title of the ContentPanel could be set to the full title and the TabPanel would provide an option to abbreviate the title of the tab (e.g. I could configure the maximum tab text length which could then be used as an argument to ellipsis() when presenting the tab text, but not when retrieving the title for the region within which the tab panel resides). I assume I could implement this myself by overriding something in the TabPanel code, but I thought I would mention it here since it may be of interest to others.

Cheers,

Scott

seade
08-12-2007, 10:38 PM
Hard coding a value is trivial - in Ext.TabPanel.prototype.createStripElements just alter the line that set the "text" parameter ub each of the two templates to use Ext.util.Format.ellipsis(text, maxTabTextLength). A little more will be required to implement the maxTabTextLength option and to perhaps pass this value down from the ContentPanel.

HTH,

Scott

seade
08-16-2007, 11:11 PM
Does anyone else like this suggestion?

I guess I will have to take a closer look at the extension mechanism rather than just throwing a hack into ext itself.

Scott