Kendo How To Change DOM element from JS and how to get changed elements

StackOverflow https://stackoverflow.com/questions/23071062

  •  03-07-2023
  •  | 
  •  

Вопрос

I have 2 connected questions

1- in kendo ui documentation it says that "When the end-user changes the value of the DOM element (or widget) the bound View-Model value is updated. If the View-Model value is updated from code the value of the bound DOM element (or widget) is updated visually."

I couldn't find how the second section (in bold) works. I tried to write

devicenoValue = "444444";

to check if the DOM element is changing but it didn't work. How can I change it from the javascript side (ofcourse without the standart jquery option)

html code is like below

            <li>
                <label>Device No
                    <input type="text" value="" id="device_no"    data-value-update="keyup"  data-bind="value: devicenoValue"/>
                </label>
            </li>

JS code is like

var settings = kendo.observable({

  devicenoValue: "444444"
});

kendo.bind($("#device_no"), settings);

2- I need to know which element was changed in the DOM. How can I find this? I tried data-value-update="keyup" but couldn't findout how to use it for this purpose

Это было полезно?

Решение

First part is easy. You just need to call set on your observable...

settings.set("devicenoValue", <yournewValue>);

Sample http://jsbin.com/budoh/1/edit

Second part, I am not sure about. You need a list of DOM elements that were updated when the above set is called on the observable ?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top