我正在尝试将多个新项添加到现有SharePoint列表中。新项目基于一组项目代码,用户将根据收到的数量设置数量,然后单击插入,带有数量的项目将添加到列表的末尾。
我考虑过一个新的项目表单,但我们使用的是SharePoint 2010基础,因此infopath不可用。相反,我可以使用第二个列表及其中的项目,然后使用工作流程将每个数量的行添加到第一个列表中,但问题是供应商只需要输入一次,而不是每行输入一次第二个清单要整洁。
有可能做我正在看的事情吗?我没有使用SharePoint Services的经验。
提前致谢
答案 0 :(得分:0)
您可以使用JavaScript来实现您想要实现的目标。
要处理Sharepoint Web服务,您可以使用SharepointPlus lib或热门SPServices。
但是,您需要具备一些JavaScript技能才能实现目标。 您的代码可能类似于(使用SharepointPlus):
<input type="text" id="itemCode" placeholder="Item Code">
<input type="text" id="quantity" placeholder="Quantity">
<input type="button" value="Add" id="buttonAdd">
<script>
$('#buttonAdd').on('click', function(event) {
event.preventDefault();
$SP().list("Your ListName for the Quantities").add({
Title:$('#itemCode').val(),
Quantity:$('#quantity').val()
}, {
error:function(items) {
if (items.length>0) alert("There are some errors !")
},
success:function(items) {
if (items.length===1) alert("Done!")
}
});
})
</script>
如果您要添加新项目的列表名为“您的数量列表名称”,其中包含两列:项目代码的“标题”和数量的“数量”。