|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Detecting Dirty Data inside a cflayout (aka Ext TabPanel)
The problem I was trying to solve was to be able to prompt the user before changing tabs whenever there is dirty data on the current tab.Mark Pitts 12/01/08 05:08 A Can you give a top down example of how to do this via javascript in a coldfusion application.Michael Hanson 09/23/11 03:39 P Can you give a top down example of how to do this via javascript in a coldfusion application.Michael Hanson 09/23/11 03:40 P The problem I was trying to solve was to be able to prompt the user before changing tabs whenever there is dirty data on the current tab. My first approach was to use the Ext.TabPanel's beforetabchange event. This strategy works if I did not implement any sort of prompting. As soon as I implement a prompt it appears that the process does not wait. With that said, I found that a better strategy would be to capture the click event on the tabPanelItem. One more hurdle to overcome, though. I discovered this thread (http://extjs.com/forum/showthread.php?p=35981) about 2 events being fired (onTabMouseDown and onTabClick) when clicking the tab. var bDirty = false; /* Tab panel hack as part of dirty data support */ Ext.override(Ext.TabPanelItem, { onTabMouseDown : function(e){ e.preventDefault(); //this.tabPanel.activate(this.id); }, onTabClick : function(e){ e.preventDefault(); /* dirty data check - start */ currentPanel = this.tabPanel; if (isDataDirty()) { confirmAction('You have modified data. Do you wish to continue?', function() { // reset flag bDirty = false; currentPanel.activate(this.id); }); } else { this.tabPanel.activate(this.id); } /* dirty data check - end */ } }); var DirtyData = function() {bDirty = true;} // end DirtyData var isDataDirty = function() {return bDirty;} // end isDataDirty Cheers! Mark (http://www.edgewater.com) Can you give a top down example of how to do this via javascript in a coldfusion application. This is what I am familiar with doing: var mytabs = ColdFusion.Layout.getTabLayout('theTab'); mytabs.on('tabchange', function (tabpanel, activetab) { getTab(activetab.getText()); }); Can you give a top down example of how to do this via javascript in a coldfusion application. This is what I am familiar with doing: var mytabs = ColdFusion.Layout.getTabLayout('theTab'); mytabs.on('tabchange', function (tabpanel, activetab) { getTab(activetab.getText()); });
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||