0
我想弄清楚如何將多個值推入數組對象。將數據推入數組 - 錯誤:無法調用未定義的方法「推」
var fileCount = 0;
var limboData = []; //trying to store values in array to create a table
function XgetAllSites(){
$().SPServices({
operation: "GetAllSubWebCollection",
async: false,
completefunc: function(xData, Status){
site = $(xData.responseXML);
site.find('Web').each(function(){
//var siteName = $(this).attr('Title');
var siteUrl = $(this).attr('Url');
Xgetlists(siteUrl);
console.log("At All Sites Level"); //check point
});
}
});
}
function Xgetlists(siteUrl){
$().SPServices({
operation: "GetListCollection",
webURL: siteUrl,
async: false,
completefunc: function(xData, Status){
$(xData.responseXML).find("List[ServerTemplate='101']").each(function(){
var listId = $(this).attr('ID');
XgetListItems(listId, siteUrl)
console.log("At site list"); //check point
});
}
});
}
function XgetListItems(listId, siteUrl){
$().SPServices({
operation: "GetListItems",
webURL: siteUrl,
listName: listId,
CAMLViewFields: "<ViewFields Properties='True' />",
CAMLQuery: '<Query><Where><And><Eq><FieldRef Name="_UIVersionString" /><Value Type="Text">1.0</Value></Eq><IsNotNull><FieldRef Name="CheckoutUser" /></IsNotNull></And></Where></Query>',
async: false,
completefunc: function (xData,Status){
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var fileName = $(this).attr('ows_LinkFilename');
var fileUrl = $(this).attr('ows_FileDirRef');
var checkedTo = $(this).attr('ows_LinkCheckedOutTile');
var modified = $(this).attr('ows_Modifiedff');
limboData[fileCount].push({fileName: fileName, fileUrl:fileUrl,checkedTo:checkedTo,modified:modified}); //trying to store information from returned values in array using fileCount as the index
fileCount++;
console.log("At list items. File Count: "+fileCount);
});
}
});
}
工作完美,謝謝。 – Batman