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

Use Kendo windows to set "selectedItem" values?

4 Answers 90 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 10 May 2012, 02:38 PM
I have click events on elements to set a model "selectedItem" value (initialized as null, but set on click...)

Can I somehow data-bind a window to do the editing of those selected values?  Do you know what I mean...popup editing of an "Item"?

Nothing I try seems to work at all :/ ...so is it even possible?

viewModel = kendo.observable({
        selectedItem: null,
        editItem: function (item) {
           selectedItem = item;
      }
});

Also when I set the data-role on the window to be "window" can I not still get a reference to it with $("#window).data("kendoWindow") to get\change values?  Seems to keep being "undefined" for me.

Thanks,
Steve

4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 15 May 2012, 12:32 PM
Hi Steve,

In order to implement this scenario you can create a window and bind the input editors to the corresponding fields.
I tried to reproduce the problem with receiving the window instance, but to no avail. Could you please check this example and let me know what I am missing?

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 15 May 2012, 01:03 PM
Hey Alexander,
  I was thinking something more like this: http://jsfiddle.net/BvUzS/17/

...although the click event isn't triggering, not sure why
0
Alexander Valchev
Telerik team
answered on 15 May 2012, 04:04 PM
Hi Steve,

The click event is not triggered because it is bind with incorrect syntax:
<input type="button" value="edit" data-bind:"click: editItem"/>
//data-bind="click: editItem"

In addition the parameter item does not represent the current data item. In order to retrieve it you could use the item.data. Please have in mind that it is recommended to get and set the viewModel fields through the corresponding methods. A simple "=" might not work as expected.

For convenience I have updated your fiddle.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 15 May 2012, 04:10 PM
Fantastic!  Please make this a demo :)
Tags
MVVM
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Alexander Valchev
Telerik team
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Share this question
or