Use Kendo windows to set "selectedItem" values?

5 posts, 0 answers
  1. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 10 May 2012 Link to this post

    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
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 15 May 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 May 2012 Link to this post

    Hey Alexander,
      I was thinking something more like this: http://jsfiddle.net/BvUzS/17/

    ...although the click event isn't triggering, not sure why
  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 15 May 2012 Link to this post

    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!
  6. Steve
    Steve avatar
    1851 posts
    Member since:
    Dec 2008

    Posted 15 May 2012 Link to this post

    Fantastic!  Please make this a demo :)
Back to Top
Kendo UI is VS 2017 Ready