1

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?

0

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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 });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.