MVVM bind changes

2 posts, 1 answers
  1. Zachary
    Zachary avatar
    4 posts
    Member since:
    Dec 2013

    Posted 14 Jan 2014 Link to this post

    I am using a listview / detail page in a mobile app similar to the listview > edit example.  However  I need to apply some formatting and some logic at display time.

    My calling view has a dataset already loading and I am calling my detail view with a tap and passing the uid.  Pretty much like the example.  I am using var model = ds.getByUid(e.view.params.uid) and then binding to the view.  I need to apply some logic to one field and some formatting to a couple others (date, money, etc).  How can I accomplish this?

    I have seen examples of creating a model using kendo.observable but if I do that, how do I use the passed dataset in that model?

        <input id="date" type="text" data-bind="value: posted_at" />  // need this formatted using kendo.toString(kendo.parseDate(posted_at), "d")
       <input id="seller" type="text" disabled="disabled" data-bind="value: seller" /> // this needs to be processed by getSeller()
  2. Answer
    Petyo avatar
    2444 posts

    Posted 14 Jan 2014 Link to this post

    Hello Zachary,

    this is the correct direction indeed; you can use a kendo.observable instance for the given view, and use the viewModel set method to assign the retrieved db record to it (it will automatically update the bindings). In addition to that, you can bind to a viewmodel getter methods (for example, to getSeller), in which you can apply the necessary formatting. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top