function populateList(){
var _clientContext;
var _web;
_clientContext = new SP.ClientContext.get_current();
_web = _clientContext.get_web();
var listTitle = "Data1";
var list = _web.get_lists().getByTitle(listTitle);
var myquery = new SP.CamlQuery();
myquery.set_viewXml('valid query');
var allItems = list.getItems(myquery);
_clientContext.load(allItems);
_clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded()), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
var listEnumerator = this.allItems.getEnumerator(); //this craps out
}
I get the error
"Error: The collection has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested."
allItems.getEnumerator();
instead ofthis.allItems
? It might be an issue with the scopes.setTimeout
to make this work...