Step 1. Enclose the following style imports to a style tag on the XPage
@import "../resources/dojo.css"; @import
"../dijit/themes/tundra/tundra.css";
Step 2: Add the inclusion of the dojo.xd.js to the XPage as mentioned below
<script type="text/javascript" src="dojo.xd.js" djConfig="parseOnLoad: true">
</script>
Step 3: Associate the following script with the XPage
dojo.require("dojo.parser");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.form.Button"); dojo.require("dojo.widget");
Step 4: Put the following div tags on the page and preview the same. You will be able to see a nice good tabbed table on your screen
<h1>Tab Container</h1>
<div id="mainTabContainer" dojoType="dijit.layout.TabContainer"
style="width:500px;height:100px">
<div id="tab1" dojoType="dijit.layout.ContentPane"
title="First Tab" selected="true" closable="true">
First Tab
</div>
<div id="tab2" dojoType="dijit.layout.ContentPane"
title="Second Tab" closable="true">
Second Tab
</div>
<div id="tab3" dojoType="dijit.layout.ContentPane"
title="Third Tab" closable="true">
Third Tab
</div>
</div>
Note : We can work with the tabbeb table through dojo code as well. Following is a simple way of selecting a particular tab
var tabbedPanel = dojo.byId("mainTabContainer");
tabbedPanel.selectTab("tab2");
Hope this helps :)
Thanks a ton for posting this. I really didn't want to use the default tabbed table provided by x Pages as it hits the server every-time any tab is clicked. Thanks again really appreciate your post.
ReplyDeleteselectTab is not working. Is it a pre-defined function?
ReplyDeleteIt has been a while since I have used it. I guess yes. Check with dojo docs to make sure of it. Cheers
ReplyDeleteHave you tried using instead of di> for the tabbed table in xpages? I need to use xp:panel and selected=true is not available for xp:panel. It works only for div. I need to show the 2nd tab like the screenshot above.. but with xp:panel. If you have a ready answer, it will help.
DeleteYou got to encode your html before replying since the page eats up HTML Markups. Guess u are asking if u can use <xp:panel> instead of <div>.
Deletetry nesting the panel inside the div. Let me know if that helped
Nesting did not allow hide/when to work as expected. Fortunately I could convince the requester to change the tab order :-).. let the default work!
DeleteHello, Does anyone know where to find the complete list of:
ReplyDeletedata-dojo-props values
data-dojo-type values
doLayout magic-word attributes
these 'magic' attributes and their values?
Is there some file or Book ?
I see attributes magically added or types pulled out of this air (seemingly), and No One is saying where the heck they got the attributes from.
thx