ListView + DataSource + odata + 2way Binding

2 posts, 0 answers
  1. Bernhard Pichler
    Bernhard Pichler avatar
    1 posts
    Member since:
    May 2010

    Posted 22 Oct 2013 Link to this post


     in my viewmodel i have defined a datasource with type: "odata".
    The datasource is bound to a listview like this:
    var template = kendo.template($("#Template_Pre").html()
                          + viewModel.templates["someKey"].Item
                          + $("#Template_Sub").html());
        dataSource: viewModel.listDataSource,
        template: template,
        appendOnRefresh: false,
        pullToRefresh: true,
        scrollThreshold: 30
    The used template is a combination of parts defined in html and code. - including some if-statements.
    Inside the template i have this textbox:
    <input data-role="numerictextbox" data-bind="value: someIntValue" />

    This should make it possible for the user to change the "someIntValue" directly from the list.
    In another function i want to foreach all the bound items and submit the new "someIntValue" values to the server,
    but every time i try that the values are still the original ones.

    Any ideas what i'm missing to make this work?

    Here is the model i defined in the schema of the datasource:
    model: {
            id: "myId",
            fields: {
                myId: { editable: false, type: "number" },
                someStringValue: { editable: false, type: "string" },
                someIntValue: { editable: true, type: "number", validation: { min: 0 } }

  2. Petyo
    Petyo avatar
    2436 posts

    Posted 23 Oct 2013 Link to this post

    Hello Bernard,

    In order for the two way binding to work as expected, the listview should be inside a bound container. The recommended MVVM usage in Kendo UI Mobile is via the data-model attribute. Please check this example for further details.

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