Why can't a Layout take a viewModel like a View? Something like this:
<div data-role="layout" data-id="service" data-init="init" data-model="viewModel"></div>
As a workaround, I am doing this the following. Is there any reason that I shouldn't be doing this?
<div data-role="layout" data-id="service" data-init="init" data-show="show"></div>
function show() {
kendo.bind($("service-layout-selector-here"), viewModel);
}
<div data-role="layout" data-id="service" data-init="init" data-model="viewModel"></div>
As a workaround, I am doing this the following. Is there any reason that I shouldn't be doing this?
<div data-role="layout" data-id="service" data-init="init" data-show="show"></div>
function show() {
kendo.bind($("service-layout-selector-here"), viewModel);
}
5 Answers, 1 is accepted
0
Hi Bart,
Petyo
Telerik
Layout view models are not supported purely due to implementation complexity. The layout header and footer are "moved" to the current view DOM element each time the view changes. this would break the mvvm bindings, which rely on a strict DOM hierarchy.
Regards,Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bart
Top achievements
Rank 1
answered on 29 Jul 2013, 02:26 PM
OK. Can you give me a recommendation as to the best way to do something like this then?
http://bit.ly/16ur63D
Do I need to repeat this "header" information within each view? Or perhaps I can have two views going at once? One for the header information and another for the body?
http://bit.ly/16ur63D
Do I need to repeat this "header" information within each view? Or perhaps I can have two views going at once? One for the header information and another for the body?
0
Hi,
Petyo
Telerik
If I understand you correctly, I do not think that you need MVVM binding for handling the button group event clicks - you can use declarative event setting instead.
Regards,Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
David Gerding
Top achievements
Rank 1
answered on 07 Feb 2014, 10:10 PM
Hi,
Is it still the case that there is no straightforward means to use Layout with separate viewModel html files? Is the real choice "viewModel OR layout widget"?
Thanks
Is it still the case that there is no straightforward means to use Layout with separate viewModel html files? Is the real choice "viewModel OR layout widget"?
Thanks
0
Hello David,
my previous response still holds true - ViewModel bindings are not supported for the layout parts. Of course, a view may have both a ViewModel and a layout attached, so I would not consider this an "or" situation.
Regards,
Petyo
Telerik
my previous response still holds true - ViewModel bindings are not supported for the layout parts. Of course, a view may have both a ViewModel and a layout attached, so I would not consider this an "or" situation.
Regards,
Petyo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!