本文介绍了共享点在jquery中使用SP.Camlquery()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在STATUS和Reason列中列出了一个目标
I am having a list Objectives with column STATUS and Reason
我用过
<script language="ecmascript" type="text/ecmascript">
ExecuteOrDelayUntilScriptLoaded(ViewItem, "sp.js");
function ViewItem()
{
var context = new SP.ClientContext.get_current();
var web = context.get_web();
var list = web.get_lists().getByTitle('Objectives');
var query = SP.CamlQuery.createAllItemsQuery();
allItems = list.getItems(query);
context.load(allItems, 'Include(STATUS)');
context.executeQueryAsync(
Function.createDelegate(this, this.success), Function.createDelegate
(this, this.failed));
}
</script>
我只需要获取状态列.我需要camlquery并且我不知道在哪里写.
I need Only Status column to be fetched.I need camlquery and i dont know where to write.
推荐答案
请参考下面的代码段,这可能会对您有所帮助
Please refer below code snippet it might help you
enter code here
function viewItem() {
var clientContext = new SP.ClientContext.get_current();
var web = clientContext.get_web();
var list = web.get_lists().getByTitle("Sample");
var camlQuery = new SP.CamlQuery();
var q = '<View><Query><Where><Eq><FieldRef Name="ID" /><Value Type="Text">10</Value></Eq></Where></Query></View>';
camlQuery.set_viewXml(q);
this.listItems = list.getItems(camlQuery);
clientContext.load(listItems, 'Include(Status,othercolumns)');
clientContext.executeQueryAsync(Function.createDelegate(this, onItemsLoadSuccess), Function.createDelegate(this, onQueryFailed));
}
function onItemsLoadSuccess(sender, args) {
}
function onQueryFailed(sender, args) {
}`enter code here`
这篇关于共享点在jquery中使用SP.Camlquery()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!