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

MVVM bind changes

1 Answer 27 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
Zachary
Top achievements
Rank 1
Zachary asked on 14 Jan 2014, 02:51 PM
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()
    

1 Answer, 1 is accepted

Sort by
0
Accepted
Petyo
Telerik team
answered on 14 Jan 2014, 04:39 PM
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. 

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