Reputation: 369
I'm trying to bind some data to a listview in win8 using javascript. The code I'm using is:
var myDS = new WinJS.UI.ArrayDataSource([{id: 1, value: xx}, {id: 2, value: yy}]); console.log("data obj created");
However, the program was blocked in the dataarray creation line, and the log was never displayed.
Anyone knows why?
Upvotes: 1
Views: 421
Reputation: 2971
In Consumer Preview, ArrayDataSource is no longer in use.
You can use WinJS.Binding.List
to bind data.
var array = [{a: 1, b: 2}, {a: 2, b:3} ... ]
var binding = new WinJS.Binding.List(array);
var listViewControl = document.getElementById('listView_ID').winControl;
WinJS.UI.setOptions(listViewControl, { itemDataSource: binding.dataSource });
Upvotes: 0
Reputation: 647
You don't appear to have the values "xx" and "yy" defined which is causing an handled javascript exception to occur which means the remaining code in the function won't execute.
Upvotes: 1