Skip to main content
added 800 characters in body
Source Link
Shawn
  • 184
  • 12
var itemCollection = {};
itemCollection is an empty object on the error line.

Just give some thoughts, havn't try the code, would pass it as pamramater work?

clientContext.executeQueryAsync(function(sender, args){
 onListRetrieveSuccess(itemCollection);
}, onSPQueryFailure);

remove the global object (itemCollection), will this work?

 publicfunctions.createRefiners = function (listName, include) {
        var itemCollection = clientContext.get_web().get_lists().getByTitle(listName).getItems('');

        clientContext.loadQuery(itemCollection, include);

        clientContext.executeQueryAsync(function(sender, args){
            var html = "";
            var listItemEnumerator = itemCollection.getEnumerator();
            while (listItemEnumerator.moveNext()) {
                var oListItem = listItemEnumerator.get_current();
                html += "<li>" + oListItem.get_item("Title") + "</li>";
            }

            $("#AdditionalFilters").append("<ul>" + html + "</ul>");
        }, onSPQueryFailure);
    }
var itemCollection = {};
itemCollection is an empty object on the error line.

Just give some thoughts, havn't try the code, would pass it as pamramater work?

clientContext.executeQueryAsync(function(){
 onListRetrieveSuccess(itemCollection);
}, onSPQueryFailure);
var itemCollection = {};
itemCollection is an empty object on the error line.

Just give some thoughts, havn't try the code, would pass it as pamramater work?

clientContext.executeQueryAsync(function(sender, args){
 onListRetrieveSuccess(itemCollection);
}, onSPQueryFailure);

remove the global object (itemCollection), will this work?

 publicfunctions.createRefiners = function (listName, include) {
        var itemCollection = clientContext.get_web().get_lists().getByTitle(listName).getItems('');

        clientContext.loadQuery(itemCollection, include);

        clientContext.executeQueryAsync(function(sender, args){
            var html = "";
            var listItemEnumerator = itemCollection.getEnumerator();
            while (listItemEnumerator.moveNext()) {
                var oListItem = listItemEnumerator.get_current();
                html += "<li>" + oListItem.get_item("Title") + "</li>";
            }

            $("#AdditionalFilters").append("<ul>" + html + "</ul>");
        }, onSPQueryFailure);
    }
Source Link
Shawn
  • 184
  • 12

var itemCollection = {};
itemCollection is an empty object on the error line.

Just give some thoughts, havn't try the code, would pass it as pamramater work?

clientContext.executeQueryAsync(function(){
 onListRetrieveSuccess(itemCollection);
}, onSPQueryFailure);