Lui*_*cia 6 javascript sharepoint jquery sharepoint-2010 csom
我试图从显示模板上的sharepoint列表项获取所有字段值,ctx.CurrentItem只获取一些值,但不是我需要的全部值.
我尝试了以下代码,但我在标题上收到错误
SyntaxError:无法在'Document'上执行'querySelector':'[object HTMLDocument]'不是有效的选择器.
function GetListItemById_Success(sender, args)
{
var id = ListItem.get_id();
var title = ListItem.get_item("Title");
alert("Updated List Item: \n Id: " + id + " \n Title: " + title);
}
// Display an appropriate error message
function GetListItemById_Fail(sender, args)
{
alert("GetListItemById Failed. \n" + args.get_message() + "\n" + args.get_stackTrace());
}
$(document).ready(function () { ExecuteOrDelayUntilScriptLoaded(CustomAction, "sp.js"); });
function CustomAction(){
var clientContext = new SP.ClientContext.get_current();
var web = clientContext .get_web();
var targetList = clientContext.get_web().get_lists().getByTitle('Test Document Library');
var list = web.get_lists().getByTitle('Test Document Library');
ListItem = list.getItemById(ctx.CurrentItem.DocId);
clientContext.load(ListItem, "Id", "Title");
clientContext.executeQueryAsync(GetListItemById_Success, GetListItemById_Fail);
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
17184 次 |
最近记录: |