I need to use BorderContainer inside a TabContainer in dojo. My requirement is to have 3 different pane inside each of the tab which I will create. So for that I am trying to use BorderContainer inside TabContainer but it seems to be not working. Here is what I am trying.
A,B and C are the tabs which i am trying to create.Inside which I am using ContentPane for each of them and then BorderContainer to specify left,center and right region for that particular tab.
But it is not giving me any output. Please advise what i am doing wrong here.
<div data-dojo-type="dijit/layout/TabContainer" data-dojo-props="splitter:true, region:'top'">
<div data-dojo-type="dijit/layout/ContentPane" title="A" selected="true" data-dojo-props="splitter:true">
<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="guuers:false">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'left'">Left pane of Tab A</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'center'">Center pane of Tab A</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'right'">Right pane of Tab A</div>
</div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="B" data-dojo-props="splitter:true">
<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="guuers:false">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'left'">Left pane of Tab B</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'center'">Center pane of Tab B</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'right'">Right pane of Tab B</div>
</div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" title="C" selected="true" data-dojo-props="splitter:true">
<div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="guuers:false">
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'left'">Left pane of Tab C</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'center'">Center pane of Tab C</div>
<div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="splitter:true,region:'right'">Right pane of Tab C</div>
</div>
</div>
</div>
Your declarative markup is correct, but since I can't see the rest of your code I would guess that you are not calling require on TabContainer, BorderContainer and ContentPane. Dojo needs you to bring those in before you can use them declaratively like you are doing. So you would need this in your javascript:
require([
"dojo/parser",
"dijit/layout/BorderContainer",
"dijit/layout/TabContainer",
"dijit/layout/ContentPane"
]);
Here is a pen that shows your code works, so I would check to see if you are pulling in those modules with require.
http://codepen.io/kyledodge/pen/MwpMZm
The other thing to check is if your dojoConfig is set to parseOnLoad:
dojoConfig = {
parseOnLoad: true
};
If not, you'll either need to set that, or require dojo/parser and call parser.parse(). Parser is key to using the data-dojo-type attribute like you are doing. Here is some info that may be helpful:
http://dojotoolkit.org/reference-guide/1.10/dojo/parser.html
I don't exactly have an answer but I think I can pin down exactly why nothing shows up: The border container doesn't seem to "fill" the containing object. I'm trying to put a border container inside another border container, and its child nodes are present but seem to end up with zero height. Apparently you have to explicitly set the border container's dimensions.
Related
I have been using owl carousel 1.3 on pages that generally have a wrapper container that sets the width to 1200px.
I started to build responsive sites and don't use a fixed width on any wrappers now, i am also using version 2 of Owl.
I am using the bootstrap grid layout and trying to make my owl carousel responsive. However i can't get this to work and it seems it only works if you set a width on a parent div.
For example if i have this:
<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<div class="owl-carousel">
<div><h2>Item 1</h2></div>
<div><h2>Item 2</h2></div>
<div><h2>Item 3</h2></div>
</div>
</div>
<div class="col-md-4">
<h2> Just a right hand panel</h2>
</div>
</div>
</div>
The owl slider will take up 100% of the screen width, it will ignore the col-md-8 width of 66% so i end up with a broken layout.
Is owl carousel truly responsive or do you have to fix a width to it for it to work?
I know this is old problem but i sloved it with wrapper and little jQ code.
Owl-carousel doesnt support bootstrap class "container-fuild", and when you use this class for owl, will crash width of your page so you need to set width of the wrapper.
Remember add resize event.
My HTML ( div with class owl-wrapper used in jQ ):
<section class="container-fluid">
<div class="owl-wrapper">
<div class="row">
<div class="col-md-8">
<div class="owl-carousel owl-theme ">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
</div>
</div>
</div>
</div>
</section>
jQuery file:
$(document).ready(function($){
var windowWidth = $( window ).width();
$('.owl-wrapper').css('width', windowWidth);
$('.owl-carousel').owlCarousel({
loop:true
});
});
Try putting min-width : 100% on the parent container.
I have a panel that floats right within a container. When my data-spy affix executes, the side-panel gains the position: fixed property which removes the float: right. The panel becomes fixed at the correct height, but becomes fixed at the left in the container not the right in the container. I cannot simply state a fixed value for the left property because I am using a container fixed to 1200px, not container-fluid and the left offset changes whenever the user resizes their screen.
How can I set the panel mimic float-right while affixed near the top of the view?
<div id="navbarContainer" class="affix-top clearfix" data-spy="affix" data-offset-top="70">
<div class="navbar navbar-inverse navbar-static-top" role="navigation" id="topnavbar">
</div>
</div>
// code removed
<div class="container">
<div id="right_panel" class="panel right-panel pull-right">
<div class="panel-head">
Related Information
</div>
<div class="panel-body">A Basic Panel</div>
</div>
css
.rightpanelAffix{
position:fixed;
top:101px;
}
js
$("#navbarContainer").on("affixed.bs.affix", function () {
$("#body").addClass("bodyAffixPadding");
$("#right_panel").addClass("rightpanelAffix");
});
$("#navbarContainer").on("affixed-top.bs.affix", function () {
$("#body").removeClass("bodyAffixPadding");
$("#right_panel").removeClass("rightpanelAffix");
});
Please Show us some code. and may be you want to ask that you can't adjust your container size. Let me know if this helps.
Check this out
<div class="container">
<div class="row">
<div class="col-lg-1 col-md-6"></div></div></div>
I want a BorderContainer like the picture, two ContentPane at the top, and one in the bottom, but I'm not able to do it with the regions, so I don't know if there isn't a way to do it with the regions.
Thank you
It depends a little bit on how you want the panes to scale when you resize the window. Do you want the bottom pane to take all extra height? Do you want the top two panes to stay 50/50 in width?
Assuming you want the division of space to stay 50/50 both in width and height, you could do it like this:
<div data-dojo-type="dijit/layout/BorderContainer">
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'leading'"
style="width: 50%">leading</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center'">center</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'bottom'"
style="height: 50%">bottom</div>
</div>
Normally, the center region will grab all extra space when you resize the window, but you can set a relative width/height on the leading/top/trailing/bottom regions so that they always use that share of the screen.
I think you want to have a nested border container. Basically, you want a top and center (or center and bottom) and in the top put a left and center (or center and right).
<div data-dojo-type="dijit/layout/BorderContainer">
<div data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="region: 'top'" style="height: 50%">
<div data-dojo-type="dijit/layout/ContentPane" style="width: 50%"
data-dojo-props="region: 'left'">inner top left</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center'">inner top center</div>
</div>
<div data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region: 'center'">outer center</div>
</div>
I loop over an array of objects, adding a custom widget to the page each time. I need to put a "space" div atop each widget, and "pageBreak" div at the bottom of each widget. Here is the creation/placement of the widgets inside the loop:
var placeIt = true;
array.forEach(data.features,function(feat,i){
var newDijit = new printDijit({}, domConstruct.create('div'));
newDijit.placeAt(dom.byId('printWindow'));
newDijit.startup();
if (placeIt){
newDijit.cNode(domConstruct.create("div",{class:'space',innerHTML:'a'}));
placeIt = false;
}else{
newDijit.cNode(domConstruct.create("div",{class:'break',innerHTML:'a'}));
placeIt = true;
}
});
Here is the widget:
require([
"dojo/parser",
"dojo/ready",
"dojo/_base/declare",
"dojo/dom-construct",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin"
], function(parser, ready, declare, domConstruct, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin){
declare("printDijit", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin],{
templateString: dojo.cache(new dojo._Url("printDijit.html")),
cNode: function(htmlCnode){
domConstruct.place(htmlCnode,this.domNode.id,'before');
}
});
});
Here is the widget template; printDijit.html
<div class="printTemplateCls" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'">
<div class="printHeaderCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">Top-header</div>
<div class="printInputsCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">Top-right pane</div>
<div class="printBottomPaneCls" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="region:'bottom', gutters:false">
<div class="printPicCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'" style="width:342px">Bottom-left pane</div>
<div class="printMapCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div>
</div>
The html in fireBug looks fine, but the 2nd and onward space/break div's are behind the widget and dont' flow correctly (see screenshot). If the widgets declared everything is good.
Anyone know what's going on here?
had to wrap the template in an outer div, like below. I would assume this is because the original root element was also a widget.
<div>
<div class="printTemplateCls" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'">
<div class="printHeaderCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">Top-header</div>
<div class="printInputsCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">Top-right pane</div>
<div class="printBottomPaneCls" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="region:'bottom', gutters:false">
<div class="printPicCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'leading'" style="width:342px">Bottom-left pane</div>
<div class="printMapCls" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'"></div>
</div>
</div>
I am a dojo newb so I am probably making a simple error somewhere. I am trying to get a borderContainer set up without liveSplitters but even though I set it to false the splitters are still there. The gutters:false property is reflected properly Please help me figure out what I am doing wrong.
Thanks
<body class="claro">
<div id="appLayout"
data-dojo-type="dijit.layout.BorderContainer"
data-dojo-props="design: 'headline', gutters: false, liveSplitters: false ">
<div class="centerPanel" data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region: 'center'">
<div>
<h4>Group 1 Content</h4>
<p>para 1</p>
</div>
<div>
<h4>h4 para 2</h4>
</div>
<div>
<h4>h4 para 3</h4>
</div>
</div>
<div class="edgePanel" data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region: 'top'">Header content (top)</div>
<div id="leftCol" class="edgePanel"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region: 'left', splitter: true">Sidebar
content (left)</div>
</div>
Remove the splitter attribute from the content pane.
<div id="leftCol" class="edgePanel"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region: 'left'>Sidebar
content (left)</div>
The liveSplitters property describes the behavior of the splitters, NOT whether they exist.
// liveSplitters: [const] Boolean
// Specifies whether splitters resize as you drag (true)
// or only upon mouseup (false)
liveSplitters: true,