来终结动态生成父子列表更新的列表项吧。
两次上图没上成功,现在附上一串动态生成列表项的代码吧。
function EditChildItems() {
var context = new SP.ClientContext.get_current();
var oWebsite = context.get_web();
var oList = oWebsite.get_lists().getByTitle(editChildList);
var itemId = $('#itemId').val();
var foreignkey = editForeignKeyName;
//ROW
$("#ParentChild tr.newTr").each(function () {
var Id = $(this).children("td").children("input.ID").val();
var oListItem = oList.getItemById(Id);
/
/
// TD
$(this).children("td").each(function () {
var fieldName = $(this).children("input").attr("class");
var value = $(this).children("input").val();
if (fieldName != "ID") {
oListItem.set_item(fieldName, value);
}
})
///
oListItem.set_item(foreignkey, itemId);
oListItem.update();
//context.load(oListItem);
context.executeQueryAsync(
Function.createDelegate(this, successHandler),
Function.createDelegate(this, errorHandler)
)