bencripps
bencripps

Reputation: 2053

Dynamic CFTab onClose event

I simply can't find any real documentation on ColdFusion Layout Tabs. For the most part I've got them working, but I'd like to tie some logic to a close event. I was wondering if anyone had a working example they could show me? The catch is that I will need to trigger these events in JavaScript. But if you have a working version in plain ColdFusion, I'd still love to see it!

var tab = ColdFusion.Layout.getTabLayout("innerTabLayout").activeTab._cf_body;

$('#' + tab).on('close', blah); // doesn't work

tab.on('close', blah) // doesn't work

ColdFusion.Layout.getTabLayout("innerTabLayout").activeTab._cf_body.onTabClose( function(), blah ); //doesn't work

I have also tried setting the event on tab creation:

var tab = ColdFusion.Layout.createTab();

tab.onTabClose()

tab.on('close');

However, none of these work either. I've tried looking at EXT.JS which is what CFtabs were created from, but I don't seem to have any luck there either.

The Coldfusion.Layout object has a function for tab closing, so there must be a way to trigger it! (I would think, haha).

Upvotes: 0

Views: 119

Answers (1)

bencripps
bencripps

Reputation: 2053

So after spending some too much messing around with the tab, I've got a solution.

ColdFusion.Layout.getTabLayout('innerTabLayout').activeTab.on('close', function(e) {

   console.log(this) //this will return the tab object

   console.log(e)//this also returns the tab object

});

This will trigger the event when the active tab within a parent is closed. I'm interested to see if there's another, better solution.

Upvotes: 1

Related Questions