我已从一个弹出窗口(通过Sharepoint页面/“仪表盘”上的按钮激活)窗口工作,该窗口从SharePoint列表中打开一个新表单。这就是弹出窗口的样子。
SharePoint New Form for Event XYZ
注意:促销项目,购买的数量,事件和删除(标志!!)都使用SharePoint新表单进行了修改。这些输入全部位于SharePoint列表中的其自己的列中(从另一个角度来看)。保存该项目时,会发生这种情况:
注意:保存后创建/创建玩具项目时,会将其保存到另一个SharePoint列表中以备记录。
现在,请注意删除按钮。创建玩具项目时,“删除”标志默认为“否”。 目的:我想单击删除按钮,并将共享点选择值从“否”更改为“是”。到目前为止,我到目前为止已经创建了此代码(不起作用):
function deleteGuestName(parent, parentID){
var clientContext = new SP.ClientContext.get_current();
var oList = clientContext.get_web().get_lists().getByTitle('Toy Order List'); //SP list name
this.oListItem = oList.getItemById(listID);
this.oListItem = oList.set_item("Delete","Yes"); //I thought this would change the choice field
oList.update();
oListItem.deleteObject();
clientContext.executeQueryAsync(
Function.createDelegate(this, this.onQuerySucceeded),
Function.createDelegate(this, this.onQueryFailed)
)
}
function onQuerySucceeded() {
refreshGrid();
parent.closeHSPopup();
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());
}
对此提供了任何帮助,我们深表感谢。如果需要,我很乐意澄清。 thnxx
这里是您对代码的疑问。
this.oListItem = oList.getItemById(listID);
要获取列表项,oList.getItemById(listID)
应为oList.getItemById(itemid)
要更新列表项,oList.update()
应为
this.oListItem.set_item("Delete","Yes")
this.oListItem.update()
以及如果要更新项目,为什么要呼叫oListItem.deleteObject()
删除项目?