Attaching components in onselect event

I have a tabbar with 3 tabs. I’m attaching grids to the inactive tabs when the onSelect event fires. But the problem is I need to attach the grid only once. But the onSelect event fires every time I hit the particular tab.

Is there any way to check if the tab has already a component attached ?

Is there any way to check if the tab has already a component attached ?

Instead of checking the attached component you may set some flag when the grid is attached. for example if there are 3 tabs with ids: “t1”, “t2” and “t3”, you may use the following:

[code]var grids = {};

tabbar.attachEvent(“onSelect”,function(id){
if(!grids[id]){
grids[id] = this.cells(id).attachGrid();

}
return true;
})[/code]