我在使用sharepoint 2010 UI框架对话框函数显示的aspx页面(javascript)中使用代码。
但是,它会抛出错误。我无法得到确切的细节。但这是代码
函数DoReject(rejectype){
rejecttype = rejectype;
this.clientContext = new SP.ClientContext.get_current();
var targetList = clientContext.get_web().get_lists().getByTitle('Applications');
var qs = window.location.search.substring(1); var arrs = qs.substring(0,qs.indexOf('&',0))。replace('arr =','')。split(',');
for (var i = 0; i < arrs.length;i++) {
k = arrs[i];
if (k != null && k != '') {
try {
this.applicant = targetList.getItemById(k);
applicant.set_item('ApplicationStatus', 'REJECTED');
applicant.update();
clientContext.executeQueryAsync(Function.createDelegate(this, this.doNothingReject), Function.createDelegate(this, this.rejectError));
this.applicant = targetList.getItemById(k);
clientContext.load(applicant, 'EMail', 'CrisDBID', 'ApplyJobTitle', 'JobRef', 'BrandId');
clientContext.executeQueryAsync(Function.createDelegate(this, this.DoRejectSuccess), Function.createDelegate(this, this.rejectError2));
}
catch (e) {
alert(e);
}
}
}
}
注意我没有包含成功/错误方法,因为它们在这里是多余的。并且id正确返回 - 它们被传递到查询字符串中。所以变量k肯定是列表项的id。
在错误事件rejectError中,我使用签名
rejectError(e)中
有谁知道如何从参数/错误代码中获取错误详细信息?
是否可以使用javascript对象模型在不是本机列表页面的页面上调用列表操作?
提前谢谢 中号答案 0 :(得分:0)
您收到错误的浏览器是什么?浏览器之间的错误是否一致?我建议您调试javascript并查看该行中的变量,然后才能看到正在发生的事情。
在旁注中,您粘贴的第一个片段看起来像标准的火车残骸,所以如果代码失败,那么其中一个可能是undefined
(如果clientContext,get_web()或get_lists()没有返回一个值)。我对Sharepoint UI框架一无所知,所以“列表操作”等对我说不多。