This is a migrated thread and some comments may be shown as answers.

Page with two view models -

1 Answer 218 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Alvaro
Top achievements
Rank 1
Alvaro asked on 25 May 2012, 04:58 AM
Hi, 

I have an app that has a menu using MVVM which is created on the layout page (asp.net mvc 3)

The "center" part of my app, is actually a specific UI to get something done, that also uses MVVM. 

So my page has 2 view models at the same time, always.

I have noticed that depending on the order in which I do kendo.bind(), it may break the MVVM functionality for events.

The change event of my grid, get's the wrong viewmodel sent as an argument.

This is the actual error :

  1. Uncaught TypeError: undefined is not a function kendo.web.js:7038
    1. binders.widget.events.Binder.extend.refresh.handlers.(anonymous function)kendo.web.js:7038
    2. Class.extend.triggerkendo.web.js:156
    3. Widget.extend._selectable.that.selectable.kendo.ui.Selectable.changekendo.web.js:18322
    4. Class.extend.triggerkendo.web.js:156
    5. Widget.extend.valuekendo.web.js:10465
    6. Widget.extend._upkendo.web.js:10448
    7. e.extend.proxy.gjquery-1.7.2.min.js:2
    8. f.event.dispatchjquery-1.7.2.min.js:3
    9. f.event.add.h.handle.ijquery-1.7.2.min.js:3

I have also created a JsFiddle that shows the exact same error. 

Is this an actual error, or am I doing something really wrong ?

Thanks, 

Alvaro Oliveira.
 

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 28 May 2012, 02:30 PM
Hi,

 Calling kendo.bind the second time would unbind anything bound previously. Also all widgets will be initialized twice (hence the grid behaving strange).

 You should specify a more specific selector as the first argument in order to bind only the required DOM tree. Please check the modified jsfiddle: http://jsfiddle.net/korchev/4Nkqt/9/ 

Greetings,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MVVM
Asked by
Alvaro
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or