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

ListView + DataSource + odata + 2way Binding

1 Answer 79 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Bernhard Pichler
Top achievements
Rank 1
Bernhard Pichler asked on 22 Oct 2013, 12:02 PM
Hi,

 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());
 
$("#mylist").kendoMobileListView({
    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 } }
            }
        }

1 Answer, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 23 Oct 2013, 10:12 AM
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.

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