Not yet rated

Problem

I want to style a tab using cflayout when the tab is created.

Solution

Using javascript:ColdFusion.Layout.createTab you can set the "configObject" configuration parameters for the object. It's in here you can style the tab before its created.

Detailed explanation

There are not many examples of how to created a new tab and then 'style' it, you could of course style your tab using an external style sheet, but where is the fun in that!

Function syntax


ColdFusion.Layout.createTab(layout,


layoutArea, Title, URL [, configObject])

configObject is what your  interested in. It sets configuration parameters for the object including style.

A example could be...


style:"padding:0.5em"


used like so...


javascript:ColdFusion.Layout.createTab('layout','area',

'I am a new tab',"page.cfm",{inithide:false,selected:true,closable:true,style:"padding:0.5em"});

Real example

An example of this in use. You have a CFGRID and create a new button

function init(){
var grid = ColdFusion.Grid.getGridObject("name-of-Grid");
var gridHead = grid.getView().getHeaderPanel(true);
var tbar = new Ext.Toolbar(gridHead);
 //button
tbar.addButton({
text:"New Tab",
cls:"x-btn-text-icon",
icon:"./images/icons/group_go.png",
handler:newTab
});
tbar.addSeparator()       
}

When clicking this button you fire the following function which creates a new tab with its styling already defined.

//function runs when new tab is clicked
function newTab(button,event){
javascript:ColdFusion.Layout.createTab('
layout','
layoutArea', 'I am  new
Tab',"page.cfm",{inithide:false,selected:true,closable:true,style:"padding:0.5em"});
}

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes