REST查询2个列表 [英] REST query for 2 lists
本文介绍了REST查询2个列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好。
我同时从2个列表中获取项目('Инструкции'和''test')并将它们放在页面上的表格中。
现在我有一个列表的工作解决方案 - 'Инструкции'(参见下面的示例)。
我正在使用SharePoint 365.
我不是开发人员。所以如果你能请回复代码(不只是说你需要做这个和这个。
谢谢。
Hi All.
I am triyng to get items from 2 lists ('Инструкции' and "'test')at the same time and the put them into a table on a page.
Now I have working solution for one list - 'Инструкции' (see example below).
I am using SharePoint 365.
I am not a developer. So if you can please reply with code (not just saying "you need to do this and this".
Thanks.
$(document).ready(function() {
loadMyItems();
});
function loadMyItems() {
var oDataUrl = "https://site.example/_api/Web/Lists/GetByTitle('Инструкции')/items?$select=Title,EncodedAbsUrl,Device,Related_x0020_application,Key_x0020_words&$filter=(ShowOnSearchPage eq 'Yes')&$top=5000";
$.ajax({
url: oDataUrl,
type: "GET",
dataType: "json",
headers: {
"accept": "application/json;odata=verbose"
},
success: mySuccHandler,
error: myErrHandler
});
}
function mySuccHandler(data) {
try {
var dataTableExample = $('#table_id').DataTable();
if (dataTableExample != 'undefined') {
dataTableExample.destroy();
}
dataTableExample = $('#table_id').DataTable({
scrollY: true,
"aaData": data.d.results,
"aoColumns": [{
"mData": "Title",
"render": function(data, type, row, meta){
return data = '<a href="' + row['EncodedAbsUrl'] + '">' + data + '</a>';}
},{
"mData": "Device",
"render": function( data, type, full, meta) {
if(!data){var returnText = "";}
else {var returnText = data.results;}
return returnText; }
},{
"mData": "Related_x0020_application",
},{
"mData": "Key_x0020_words",
}
]
});
} catch (e) {
alert(e.message);
}
}
function myErrHandler(data, errCode, errMessage) {
alert("Error: " + errMessage);
}
我的尝试:
不幸的是我在谷歌找不到答案。
What I have tried:
Unfortunatelly I couldn't find an answer in Google.
推荐答案
(document).ready(function(){
loadMyItems( );
});
函数loadMyItems(){
var oDataUrl =https://site.example/_api/Web/Lists/GetByTitle('Инструкции')/ items?
(document).ready(function() { loadMyItems(); }); function loadMyItems() { var oDataUrl = "https://site.example/_api/Web/Lists/GetByTitle('Инструкции')/items?
select = Title,EncodedAbsUrl,Device,Related_x0020_application,Key_x0020_words&
select=Title,EncodedAbsUrl,Device,Related_x0020_application,Key_x0020_words&
filter =(ShowOnSearchPage eq'Yes')&
filter=(ShowOnSearchPage eq 'Yes')&
这篇关于REST查询2个列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文