Search code examples
javascripthtmldata-bindingkendo-uikendo-mobile

kendo UI binding select elements


I'm building a simple mobile application and I want to bind html select elements to an observable kendo object. With simple input text straightforward but with select elements am receiving a error when changing select values:

Uncaught TypeError: Object #<Object> has no method get

Here is the jsfiddle example:

JS Fiddle example

Additionally on insert button, the object is not changing the property values present on the select elements.


Solution

  • The problem with the selects is that you have defined a function and it needs to be an object. Try defining them as:

    zonas       : [
        { ZonaId : 1, nome : "zona1" },
        { ZonaId : 2, nome : "zona2" }
    ],
    estados     : [
        { estadoId : 1, nome : "activo" },
        { estadoId : 2, nome : "inactivo" }
    ],
    utilizadores: [
        { UtilizadorId : 1, nome : "user1" },
        { UtilizadorId : 2, nome : "user2" }
    ]
    

    Regarding the insert button, the problem is that inserirEntidade is not being invoked since it is not visible/accessible when you click.

    You have to define this function as global.

    Check it here: