SharePoint JSOM,我在executeQueryAsync()函数getFamilyData中得到一个错误,它不是一个函数

时间:2017-08-13 11:55:53

标签: sharepoint sharepoint-jsom

//creating global variables//
var collListItem;
//creating global variables//
var collListItemFamily;
var collListItemType;
//creating client context//
var clientcontext = new SP.ClientContext("/sites/Products/");
//creating web//
var web = clientcontext.get_web();
//getting list data //
var Group = web.get_lists().getByTitle('Product Group');
//creating cam query//
var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml("<View><Query><Where><IsNotNull><FieldRef Name='GroupName' /></IsNotNull></Where></Query></View>");
collListItem = Group.getItems(camlQuery);
// Register the request for information//
clientcontext.load(collListItem);
// executequery for information//  
clientcontext.executeQueryAsync(success, failure);

function success(sender, args) {
    var GroupArray = [];
    var asyncCallbacks = [];
    var Typetitemenumerator = collListItem.getEnumerator();
    while (Typetitemenumerator.moveNext()) {
        var TypeGroup = Typetitemenumerator.get_current().get_item('GroupName');
        var TypeGroupID = Typetitemenumerator.get_current().get_item('ID');
        divacc += "<div class='group' id=" + TypeGroupID + ">" + TypeGroup + "</div>";
    }
    var promise = getFamilyData(Typetitemenumerator).then(function(state) {
        console.log(state);
    });
    $("div#multiple").append(divacc);
}

function getFamilyData() {
        //get family list data start//
        //trying with deferred//
        var d = $.Deferred();
        var clientcontext = SP.ClientContext.get_current();
        var web = clientcontext.get_web();
        //getting list date//.
        var listfamily = web.get_lists().getByTitle('Product Family');
        // caml query//.
        var camlFamily = new SP.CamlQuery();
        camlFamily.set_viewXml("<View><Query><Where><Eq><FieldRef Name='CitsProductGroup' /><Value Type='Lookup'>ITCGBED</Value></Eq></Where></Query></View>");
        collListItemFamily = listfamily.getItems(camlFamily);
        // Register the request for information.
        clientcontext.load(collListItemFamily, 'Include(TypeGroup)'); //loading the data
        //getting error on this line
        // Run the request on the server.
        clientcontext.executeQuerAsync(function() { //getting error on this line
                    alert("hi in family data");
                    d.resolve(collListItemFamily);
                },

在我需要获取其他列表数据的getFamilyData函数中,在执行executeQueryAsync时,由于它不是函数而得到错误,所以我们将不胜感激。

1 个答案:

答案 0 :(得分:0)

在下面的代码块中,您错过了拼写clientcontext.executeQuerAsync(function() { //getting error on this line alert("hi in family data"); d.resolve(collListItemFamily); },

executeQuerAsync

您已撰写executeQueryAsync而不是y

拼写中缺少lis2dh12_low_power_change_state(boolean_t enable);

更改拼写,它会起作用。