-1

I would like to bind my form to a kedno observable view model. I can get it to work with a hard coded value but not a DataSource. I have verified that the data source has one item in the view and I can fetch it. See code below. Any ideas? Thanks

 //Hard coded first name binds to my form correctly
 var viewModel = kendo.observable({
        first_name: "John"
    });

 kendo.bind($("form"), viewModel);




//This doesn't bind correctly
var sharableDataSource = new kendo.data.DataSource({
     transport: {
            read: {
                     url: "myurl goes here" ,
                     dataType: "json"
                   }
                }
  });

var viewModel = kendo.observable({
       datasource: sharableDataSource
    });

kendo.bind($("form"), viewModel);



//HTML I am binding to
 <li>First Name <span class="value" data-bind="text: first_name"> </span></</li>
Rick S
  • 6,476
  • 5
  • 29
  • 43

1 Answers1

0

What html are you binding with the second viewModel ?
And these aren't both on the same page right ?

Robin Giltner
  • 3,057
  • 2
  • 18
  • 26
  • Only one set of HTML. I try the first viewmodel and it works then comment it out and try the second viewmodel and it doesn't work. I'm guessing you can't assign a datasource directly to the observable, but i don't know. – Rick S Jul 15 '13 at 19:00