Dynamically Adding/Editing/Deleting Tabs on Tabbed Panels
I am using the tabbed panels and need to know how to
dynamically create a new tab with javascript with some content
inside ( and switch to it ). Also, I need to figure out how I can
delete tabs at "runtime"? I have tried many things to do this, but
everytime, it has been failing. I need a functions just like this:
addTab(title, innerHTMLcontent);
deleteTab(currIndex);
Also, I think all of the Spry Widgets should have an easy way
to dynamically change content.
Hi,
here is the js file. I am also attaching a sample (I named it
as Spry.Widget.ExtendedTabbedPanels, may be you could change it).
Let me know if you face any issues.
===================START-JS
FILE==============================
var Spry; if (!Spry) Spry = {}; if (!Spry.Widget) Spry.Widget
= {};
Spry.Widget.ExtendedTabbedPanels = function(element, opts) {
Spry.Widget.TabbedPanels.call(this, element, opts);
Spry.Widget.ExtendedTabbedPanels.prototype = new
Spry.Widget.TabbedPanels();
Spry.Widget.ExtendedTabbedPanels.prototype.constructor =
Spry.Widget.ExtendedTabbedPanels;
Spry.Widget.ExtendedTabbedPanels.prototype.addTab = function
(tabname, tabcontent, position) {
var tabs = this.getTabs();
if((!position && position != 0)|| position >
tabs.length)
position = tabs.length;
var newtab = tabs[tabs.length - 1].cloneNode(true);
this.setElementNodeValue(newtab, tabname);
this.getTabGroup().insertBefore(newtab, tabs[position]);
var tabContents = this.getContentPanels();
var newContentPanel = tabContents[tabContents.length -
1].cloneNode(false);
newContentPanel.innerHTML = tabcontent;
this.getContentPanelGroup().insertBefore(newContentPanel,
tabContents[position]);
this.addPanelEventListeners(newtab, newContentPanel);
this.showPanel(position);
Spry.Widget.ExtendedTabbedPanels.prototype.removeTab =
function(tabindex) {
var tabs = this.getTabs();
if((tabs.length == 1) || (!tabindex && tabindex !=
0) || tabindex >= tabs.length)
return false;
var tabToRemove = tabs[tabindex];
this.getTabGroup().removeChild(tabToRemove);
var contentPanelToRemove =
this.getContentPanels()[tabindex];
this.getContentPanelGroup().removeChild(contentPanelToRemove);
this.removePanelEventListeners(tabToRemove,
contentPanelToRemove);
if(this.getCurrentTabIndex() == tabindex) {
if(this.getTabs().length <= tabindex)
this.showPanel(this.getTabs().length - 1);
else
this.showPanel(tabindex);
Spry.Widget.ExtendedTabbedPanels.removeEventListener =
function(element, eventType, handler, capture)
try
if (element.removeEventListener)
element.removeEventListener(eventType, handler, capture);
else if (element.detachEvent)
element.detachEvent("on" + eventType, handler);
catch (e) {}
Spry.Widget.ExtendedTabbedPanels.prototype.removePanelEventListeners
= function(tab, panel)
var self = this;
Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
"click", function(e) { return self.onTabClick(e, tab); }, false);
Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
"mouseover", function(e) { return self.onTabMouseOver(e, tab); },
false);
Spry.Widget.ExtendedTabbedPanels.removeEventListener(tab,
"mouseout", function(e) { return self.onTabMouseOut(e, tab); },
false);
if (this.enableKeyboardNavigation)
// XXX: IE doesn't allow the setting of tabindex
dynamically. This means we can't
// rely on adding the tabindex attribute if it is missing to
enable keyboard navigation
// by default.
// Find the first element within the tab container that has
a tabindex or the first
// anchor tag.
var tabIndexEle = null;
var tabAnchorEle = null;
this.preorderTraversal(tab, function(node) {
if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
if (tabIndexAttr)
tabIndexEle = node;
return true;
if (!tabAnchorEle && node.nodeName.toLowerCase() ==
"a")
tabAnchorEle = node;
return false;
if (tabIndexEle)
this.focusElement = tabIndexEle;
else if (tabAnchorEle)
this.focusElement = tabAnchorEle;
if (this.focusElement)
Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
"focus", function(e) { return self.onTabFocus(e, tab); }, false);
Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
"blur", function(e) { return self.onTabBlur(e, tab); }, false);
Spry.Widget.ExtendedTabbedPanels.removeEventListener(this.focusElement,
"keydown", function(e) { return self.onTabKeyDown(e, tab); },
false);
Spry.Widget.ExtendedTabbedPanels.prototype.setElementNodeValue
= function(element, nodevalue) {
var currentElement = element;
var tmpElement = this.getElementChildren(element);
while(tmpElement.length != 0) {
currentElement = tmpElement[0];
tmpElement = this.getElementChildren(tmpElement[0]);
currentElement.innerHTML = nodevalue;
====================END JS
FILE==================================
===================SAMPLE
TEST===================================
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<title>Untitled Document</title>
<link href="SpryAssets/SpryTabbedPanels.css"
rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryTabbedPanels.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryExtendedTabbedPanels.js"
type="text/javascript"></script>
</head>
<body>
<div id="TabbedPanels1" class="TabbedPanels">
<div class="TabbedPanelsTabGroup">
<span class="TabbedPanelsTab"
tabindex="0"><b>Tab 1</b></span>
<span class="TabbedPanelsTab" tabindex="0">Tab
2</span>
</div>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">Content 1</div>
<div class="TabbedPanelsContent">Content 2</div>
</div>
</div>
<input type="text" id="tabname" />
<input type="text" id="tabcontent" />
<input type="text" id="position" />
<input type="button" value="add tab" onclick="add();"
/>
<input type="button" value="delete tab"
onclick="TabbedPanels1.removeTab(parseInt(document.getElementById('position').value));"
/>
<script type="text/javascript">
<!--
var TabbedPanels1 = new
Spry.Widget.ExtendedTabbedPanels("TabbedPanels1");
function add() {
var tabTitle = document.getElementById("tabname").value;
var tabcontent = document.getElementById("tabcontent").value;
var position = document.getElementById("position").value;
TabbedPanels1.addTab(tabTitle, tabcontent,
parseInt(position));
//-->
</script>
</body>
</html>
===================SAMPLE TEST
END=======================
Similar Messages
-
Why data are not getting poulated in dynamically added tab in a tab navigator???
Hi All,
I am facing a very strange problem and need you expert opinion on this. Ok so the problem goes like this:
In my application i have a tab navigator where i have 2 fixed tabs say tab A and tab B. In tab B I have a data grid where All the user name are getting populated. Once the user clicks on any datagrid row i am dynamically adding a new tab based on username , so if in my datagrid u1,u2 and u3 are getting displayed then once you clik on u1 a new tab called u1 is getting displayed. Code for this goes like this:
var vbox1: VBox= new VBox();
box1.label=mydatagrid.selectedItem.uName;
var sde:* = new searchDetails();
vbox1.addChild(sde);
myTabnavigator.addChild(vBox1);
Application.application.searchdetails.displayall();
I have created a component called searchDetails where i have designed the page wit various fields for this tab.This also has a method called displayall() which is populating the data in all fields using php an my sql where i have designed the page wit various fields for this tab.
New tab is getting displayed perfectly. My problem is once the tab is getting displayed fields are not getting populated with data.
Please let me know what wrong i am doing. I am really strugglingHmm.. you have to assign text to the labelfields on creation complete not before that, the fllow will be like this
var vbox1: VBox= new VBox();
var sde:* = new searchDetails();
vbox1.addEventListener(creationcompleteevent,function);
vbox1.addChild(sde);
myTabnavigator.addChild(vBox1);
function(e:event):void{
box1.label = "text"; -
Achieve the tab order for dynamically added section
Hi friends,
I'm facing the issue with tab order.
How to achieve the tab order for dynamically added sections?
Could you Plaese suggest me in this.
Thanks,
Susila SHi,
Thanks for your reply.
Ya. I'm adding rows in a table dynamically which is grouped in a subform which is flowable and the buttons are placed in the same subform. At the end of the row I'm having the hidden fields.
So what I want is without focusing the tab on hidden field I want to traverse the first field of the next dynamic row. For that I have used the access property as protected on hidden field, but its not working properly.
Please help me on this ASAP. -
I'm using Photoshop Elements 11 and I'm wanting to add some effects and graphics. I went under the expert tab and the panel bin for the effect and graphics seems like it's not loading the icons/options, it's just blank. How can I get the panel bin to display the effects and graphics options?
Go to
C:\ProgramData\Adobe\Photoshop Elements\11.0
and delete the
ThumbDatabase.db3
Then go to
C:\ProgramData\Adobe\Photoshop Elements\11.0\Locale\en_us
and delete the
MediaDatabase.db3
Then start the photoshop elements 11 editor and wait till the effects database rebuilds, which could take awhile, like 10 to 20 minutes, so just pse 11 idle so to speak until it completes. -
Multiple dynamic analysis grids on same workbook tab
Hi,
I am trying to have 2 dynamic analysis grids in the same tab of a workbook. I can insert and run them but the top grid (query) runs into the bottom one. I know you can set the size parameters of the grid but that would only work for me if they had row structures.
Also, I need to be able to print these so turning the clipping or scrolling on won't work either.
Any ideas would be great otherwise I will have to split them up on to separate tabs.
We are on BI 7.0
Thanks,
Matt
Message was edited by:
Matt Tukey> Hi Matt,
>
> Can you check on the link below:
> SAP Business Explorer (SAP BEx)
> Can you provide little bit more detail. Thanks.
I have searched the forums with no solution found.
I want to have 2 reports on the same sheet so that the end user can look at both without having to tab back and forth. The problem I have is both queries are dynamic in there length since they have no row structures. I am hoping to find a way that BEx would automatically adjust the location of the 2nd report below the 1st one.
-Matt -
I deleted a calendar tab. How can I get the data back?
I accidently deleted the calendar tab of my wife and deleted all her apoointments on her iphone and the iMac. I am in ****. How can I get the calendar data back=?
Sync is only oneway, from PC to your device. Unless you have the music on your PC, iTunes is going to wipe out what you have on your device if you are syncing to a new library.
You can only transfer Purchased music over to Itunes on your PC.
iTunes Store: Transferring purchases from your iOS device or iPod to a computer
http://support.apple.com/kb/HT1848
As for you own music, you may have to use a third party software. A good Free one is called Sharepod which you can download from Download.com here:
http://download.cnet.com/SharePod/3000-2141_4-10794489.html?tag=mncol;2 -
So I accidentally deleted the iCloud Tabs in Safari on my iPhone. Is there a way to get it back so I can view what tabs are open on my Macbook?
Quit Safai (double tap the home button, hold the app icon until it wiggles, tap , double tap the home button gain)
Settings > iCloud > Turn off Safari > Delete from phone then turn Safari back on -
Redirect edit link to Criteria tab instead of Results tab in OBIEE 11.1.1.5
Hi all,
How to redirect edit report to Criteria tab instead of Results tab in OBIEE 11.1.1.5?
I have used the following thread but did not work for me.
OBIEE 11g Analysis : Change Report edit link to go Criteria tab instead
Thanks in advance.Hi,
I think the previous solution still works. Once, you have implemented the solution can you please make sure the url is something like
http://x.x.x.x:9704/analytics/saw.dll?Answers&Action=Criteria&path=....
Thank you,
Dhar -
how can i remove the page title above the File,Edit,View,History,Bookmark tab in firefox
In Firefox 29 and Firefox 30:
"3-bar" menu button > Customize
In the lower left, click the Title Bar button to switch the title on and off.
In Firefox 28, I actually can't remember!
I would be remiss if I didn't remind you:
* Firefox 28 is not secure: Mozilla has disclosed its [https://www.mozilla.org/security/known-vulnerabilities/firefox.html known security flaws].
* You can modify Firefox 30 to restore many of the UI features of earlier versions of Firefox using the techniques in the following article (and/or with assistance from forum volunteers): [[How to make the new Firefox look like the old Firefox]]. -
Accidentally deleted the Popular tab in safari how to get it back?
I accidetnally deleted the popular tab in safari how can i get it back?
Just doublechecking, Joann. Is that on a Safari for Windows, or on a Safari for Mac? (You've posted in the Safari for Windows forum, but your system information looks pretty Mac.)
-
Help, I accidentally deleted the parent tab set.
I accidentally deleted the parent tab set from my application, and cannot find anyway to create a new one. Has anyone had this problem?
Oracle - 9.04R2
ApEx - 2.2.0
Browser - Firefox
Thanks,
MichelleHi Scott,
unfortunately I made a stupid thing, being too smart and updating the FLOWS_020200.wwv_SOMETHING_tabs record, modifying parent tab of the problematic tab to main. Doing that caused the complete application to disappear from the Application builder. I guess some checksums in APEX internal objects were modified and that is the result.
Fortunately I had a recent export of an application, so I didn't loose too much. That also means that I can not help myself with "as of" export.
Could you please just tell if recreating parent tabs is possible by "clicking through apex screens" or should there be some hacking used.
Zober -
Create Tabbed and Accordion Panels | Adobe Muse Feature Tour | Adobe TV
Organize lengthy information in more visually appealing, “bite-sized” chunks by using fully customizable tabbed or accordion panels.
http://adobe.ly/I5cQoVAfter working with the accordion panels I've found it's about 1,000 times easier to develop your content outside the panels: selections inside of the panels is wonky at best.
-
I'm running Safari 6.0.5 - Mac OS 10.8.4 -- when I load my gmail the block around the DELETE and MOVE tabs are not usable - press buttons but nothing happens. ???
I can see the block (flashes) and the buttons are no longer usable.
I have Empted Cache but doesn't seem to help.From the Safari menu bar, select
Safari ▹ Preferences ▹ Extensions
Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.
If you wish, you may be able to salvage the malfunctioning extension by uninstalling and reinstalling it. Its settings will revert to their defaults. If the extension still causes a problem, remove it permanently or refer to its developer for support. -
HTML Panel with Tabs like Sliding Panel tabs
Hi, what do I need to add/change to have HTML panels
switching with tabs that switches background image like the tabs in
sliding panels example?
Or can I modify the
sp_withTabs.js to have graphic tabs work with HTML
Panels?Nevermind, I got it. I used the SpryTabbedPanels.js and
modified the SpryTabbedPanels.css with my graphics, size, position
and what not.
I do have one more question. I'm using HTML Panels with Fade
in and out and when loading my page I have to have default content
in the main html doc for something to display when the page loads.
Then when I click on the first button, it then loads the real
external HTML panels. Is there any way I can load my first external
HTML page right when my site loads? -
HT204394 How do I delete a sheet tab (page) in NUMBERS ?
How do I delete a sheet tab (page) in NUMBERS ?
HI Jim ..
Try this discussion > Re: How can I remove a sheet in Numbers?
Maybe you are looking for
-
I recieved my mini-dvi -> dvi apple adaptor from ebay this morning (finally!), but am having a feew teething problems. The plug fits snugly in the back of the iMac, but if pressure( only a little) is applied to the side or top of the plug (the one go
-
Cannot Delete Folders from USB drive connected to Airport Extreme
When I try to delete files from the usb drive connected to my airport I get "cannot remove folder, the directory is not empty. This only happens for some of the folders that are empty. No problem deleting any files whether they were created before or
-
MIGO -Number range for trans./event type WE in year 2012 does not exist
Hi to all i got one erro while going do MIGO , error is Number range for trans./event type WE in yar 2012 does not exist .But i checked in OBA7 for the document type WE for that company code i have already maintain number ranges for the year 2011
-
Dear Gurus, One of my FI User unable to see the Conditons tab at header and item level of the PO , where as for the same PO we are able to see the the Conditions tab at header and item level. we have maintain GR based invoice varification at Invoice
-
SELECT FROM AUSP perfomance improvement
Hi! Generally speaking our problem is long runtimes for transactions dealing with configuration (CU50, VA01/VA02/VA03). ABAP runtime analysis (SE30) and performance trace analysis (ST05) clearly show that 85% percents of total execution time is spent