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

listview change event not firing

1 Answer 679 Views
MVVM
This is a migrated thread and some comments may be shown as answers.
john
Top achievements
Rank 1
john asked on 29 Apr 2015, 12:57 AM

I have a listview defined as follows:

   <div data-role=" listview"
                     data-template="template"
                     data-bind="source: people,
                            visible: isVisible,
                             events: {
                              change: onChange
                            }"
                     style="float:left; width:100%; height: 370px;display:block;overflow: auto">

                </div>

 

now listview nicely shows my array of items but I need to update another view when the user selects a new row.My VM looks like:

var viewModel = kendo.observable({
    isVisible: true,
    onChange: function (){
        debugger;
        var data = dataSource.view(),
            selected = $.map(this.select(), function (item) {
                return data[$(item).index()].ProductName;
            });

        kendoConsole.log("Selected: " + selected.length + " item(s), [" + selected.join(", ") + "]");
    },
    onSave: function (e) {
        kendoConsole.log("event :: save(" + kendo.stringify(e.values, null, 4) + ")");
    },
   

    person: {
        Name:"John Doe"
    },
 .....

 

notice the debugger statement in the onChange function , well it is never hit as no idea what happened to the change event. I would have used Angular but

it has a problem that caused us to drop back to MVVM (Knockout). even if I make onChange a global function it does not fire.

 

Very confused

 

 

 

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 30 Apr 2015, 03:29 PM

Hello John,

Please enable the selectable option in order the selection to work and change event to be fired. Please check http://dojo.telerik.com/OZuhO example. 

Regards,
Boyan Dimitrov
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
john
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or