Table cell is not showing up
Any ideas without moving the code around?
- $(document).ready(function () {
var metricsHtml = "<table id='metrics'><tr><td width='150'>Site Name</td><td width='150'>List Name</td><td width='150'>List Type</td><td width='150'>Item Count</td><td width='250'>Created Date</td><td width='250'>Modified Date</td><td>Default List View</td></tr>";
$("#myDiv").append(metricsHtml);
$().SPServices({
operation: "GetListCollection",
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).find('List').each(function () {
listName = $(this).attr("Title");
listType = $(this).attr("ServerTemplate");
listCreated = $(this).attr("Created");
listModified = $(this).attr("Modified");
listItemCount = $(this).attr("ItemCount");
listView = $(this).attr("DefaultViewUrl");
userId = $(this).attr("Author");
metricsHtml = "<tr><td>Test</td><td>" + listName + "</td><td>" + listType + "</td><td>" + listItemCount + "</td><td>" + listCreated + "</td><td>" + listModified + "</td><td>" + listView + "</td>";
$().SPServices({
operation: "GetListItems",
listName: "User Information List",
CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + userId + "</Value></Eq></Where></Query>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
createdBy = $(this).attr("ows_Title");
metricsHtml = "<td>" + createdBy + "</td></tr>";
}); // end each
} // end completefunc
}); // end spservices
$("#myDiv table").append(metricsHtml);
}); // end each
} // end completefunc
}); // end spservices
}); // end ready function
</script>
<div id="myDiv"/>
If I move this into the second SPServices call I get unexpected results so I just need to add that one table cell to the table row in the first SPServices call. I hope my wording is correct as I am very new to client side coding. Post in SPServices forum if that helps anyone https://spservices.codeplex.com/discussions/545967