ui-layout
ui-layout copied to clipboard
disableToggle and collapsed both being ignored?
Forked the Holy Grail demo, and can't get either the collapsed attribute, or the disableToggle option to work. What am I missing?
http://plnkr.co/edit/wVp0PvbC3x4NpoSlEsin?p=preview
I'm seeing the same thing.. :( No Joy
To fix disableToggle add/merge 'ui-layout.css' to css inventory.
collapse attribute is broken using angular 1.4.9 and 1.5.0:
<div ui-layout-container collapsed="true" class="ui-layout-west dashboardPalette" style="overflow-x: visible;">
Error: [$compile:nonassign] http://errors.angularjs.org/1.5.0/$compile/nonassign?p0=true&p1=collapsed&p2=uiLayoutContainer H/<@http://localhost:8383/COP-UI/libs/angular/angular.min.js:6:416 Ec/this.$get</ia/</s<@http://localhost:8383/COP-UI/libs/angular/angular.min.js:79:1 Ec/this.$get</ia/</l@http://localhost:8383/COP-UI/libs/angular/angular.min.js:80:63 tf/this.$get</m/c<@http://localhost:8383/COP-UI/libs/angular/angular.min.js:124:1 tf/this.$get</l/e<@http://localhost:8383/COP-UI/libs/angular/angular.min.js:124:373 uf/this.$get</m.prototype.$digest@http://localhost:8383/COP-UI/libs/angular/angular.min.js:138:261 uf/this.$get</m.prototype.$apply@http://localhost:8383/COP-UI/libs/angular/angular.min.js:141:339 g@http://localhost:8383/COP-UI/libs/angular/angular.min.js:94:137 t@http://localhost:8383/COP-UI/libs/angular/angular.min.js:98:260 fg/</u.onload@http://localhost:8383/COP-UI/libs/angular/angular.min.js:99:297
http://localhost:8383/COP-UI/libs/angular/angular.min.js Line 114
@garymazz Try to set collapsed from a variable:
<div ui-layout-container collapsed="layout.isCollapsed" class="ui-layout-west dashboardPalette" style="overflow-x: visible;">
I also tried setting collapsed from a variable but it still does not work
@chrislatina You actually have to create an object:
$scope.layout = {
isCollapsed: true
}
and then:
<div ui-layout-container collapsed="layout.isCollapsed" class="ui-layout-west dashboardPalette" style="overflow-x: visible;">
@bampakoa yes I did this but with no luck... I used bower install angular-ui-layout#bower, which simply gave me ui-layout.css, ui-layout.js, ui-layout.min.js. Maybe I need to just use the github version?
Which angular version do you use?
Ah! Using Angular 1.4.8
@chrislatina You can check out my working plunker that is using Angular 1.4.9 and the latest version of ui-layout. I hope it solves your problem.
Got it working! Looks like the bower install version is different from the most recent source code on github! Thanks for the plunker
@chrislatina Glad you have solved it!
@bampakoa Something seems wrong with your plunker example. Four Div is opened on 'Close Four' button and closed on 'Open Four' button.
Thanks @goranbjelanovic ! The collapsed flag of the 4th div was the other way round.
Hi, I'm having the same issue with Angular v1.5.5 and the latest ui-layout source code from github. 'size' is being ignored as well.
@danwf I tried with 1.5.5 version but I cannot see any problem. Can you elaborate on that a bit?
@danwf If you're installing through bower, be sure to just use angular-ui-layout
and not angular-ui-layout#bower
like the first example in the README. The bower branch is and old build - 1.0.5
. I ran into the same issue with Angular 1.5.5; no errors, it just wouldn't collapse. After installing angular-ui-layout 1.4.2
everything collapsed properly.
I see this error in the console when I add collapsed="true". Expression 'true' used with directive 'uiLayoutContainer' is non-assignable!
I am using 1.4.2 version of angularI ui layout and and angular 1.4.5, I hope this version is not an issue.
Here is my HTML
<div ui-layout> <div ui-layout-container id="chartSection" collapsed="true"> <div class="clearfix main-content-chart-block"> <div class="main-content-chart"> <div class="chart-wrapper"> <vip-chart class="vip-chart" data-chart-object="dpiChartObject"></vip-chart> </div> </div> <div class="main-content-legends"> <vip-custom-legends ng-if="dpiChartObject.chartConfig.series.length" data-chart-object="dpiChartObject" data-table-object="table" data-position="right"></vip-custom-legends> </div> </div> </div> <div ui-layout-container id="tableSection"> <div id="tableContent" class="main-content-table-block"> <vip-table table-object="table"></vip-table> </div> </div> </div>
@kumaril-telsiz you have to use an object property of the controller in replacement of true variable such as vm.layout = { collapsed = true };
@bampakoa Thank you for a quick response.
Sorry for the inaccurate post ..... I meant I had tried both ways as per the example
`
$scope.layout { toolbar: true, leftSidebar: false, mycontainer: false }
The first one gives the error I mentioned and the second one does not give the error, but still does not close the container on load. Here is the second way I tried
$scope.layout = { chartContainer: false, tableContainer: true };
<div ui-layout="{ flow : 'row'}"> <div ui-layout-container id="chartSection" collapsed="layout.chartContainer"> <div class="clearfix main-content-chart-block"> <div class="main-content-chart"> <div class="chart-wrapper"> <vip-chart class="vip-chart" data-chart-object="dpiChartObject"></vip-chart> </div> </div> <div class="main-content-legends"> <vip-custom-legends ng-if="dpiChartObject.chartConfig.series.length" data-chart-object="dpiChartObject" data-table-object="table" data-position="right"></vip-custom-legends> </div> </div> </div> <div ui-layout-container id="tableSection" collapsed="layout.tableContainer"> <div id="tableContent" class="main-content-table-block"> <vip-table table-object="table"></vip-table> </div> </div> </div>
Am I doing something wrong here?
@kumaril-telsiz could you provide a plunker with your full source code or alternatively you can check this plunker of the holy-grail demo that I have created. Also note that, as @danwf mentions in a post above, there is a problem with the version of the angular-ui-layout from the bower package.
@bampakoa This is a plunker based on your plunker. I commented out these lines:
vm.config = {
flow: 'column',
// disableToggle: 'true',
// dividerSize: 0
};
and added {{vm.layout}}
to panel Three-One
.
As you can see, clicking the dividers of the One
and Four
panels changes nothing in vm.layout
.
I would expect vm.layout
to reflect the current layout situation...
@pieterjandesmedt you have to use the event ui.layout.toggle and update vm.layout
explicitly.
But why? Shouldn't there be two-way data binding? How can another component know what the layout state is if a user toggles the panel using the divider buttons?
Also: it doesn't matter if you set
vm.layout = {
one: false,
four: false
};
...
$scope.$on('ui.layout.loaded', function(){
$timeout(function(){
vm.layout.one = true;
vm.layout.four = true;
});
})
or
vm.layout = {
one: true,
four: true
};
...
$scope.$on('ui.layout.loaded', function(){
$timeout(function(){
vm.layout.one = false;
vm.layout.four = false;
});
})
the result is exactly the same. This leads to very confusing situations, see this updated plunker.
@pieterjandesmedt , @bampakoa I'm experiencing the same problem if divider buttons are enabled. Using event ui.layout.toggle doesn't help eather. After couple of clicking on divider buttons or toggle/open/close panels stops opening/closing.
@goranbjelanovic can you give us a plnkr with the code that uses ui.layout.toggle event?
@bampakoa Here is the plunker with the issue. I see couple of problems. First on ui.layout.loaded I set vm.layout.one = false; but layout one is initially open not closed. Second problem is if I close first panel with divider buttons and then click 'Open One' nothing happens.
- For vm.layout.one to be initially closed, you have to set the
collapsed
property to true either in the layout object or inside your ui.layout.loaded event. - That seems to work if you solve the 1st problem. But please advised that when you use divider buttons to toggle layout panes, you should take into account this event and programmatically update the collapsed property by yourself!
@bampakoa Yeah, first problem isn't actually a problem. It works as expected.
About the second I believe I handle ui.layout.toggle event:
$scope.$on('ui.layout.toggle', function(e, container){ console.log(container); if (container.id === '1') { vm.one = container.size > 0; } });
And if I close first panel with divider buttons and then click 'Open One' nothing happens.
Could you update plunker so that this set of action works.
A minor typo in your code vm.one -> vm.layout.one. Nevertheless, even if you change this typo, it seems that the event is not working correctly by itself (it closes and opens automatically all the time). Maybe you should implement a mechanism that checks the initiator of the toggle event, to prevent this behavior. I did not have much time to find any reliable solution for this problem. In case you find one, it would be nice if we could take a look.