Loading...

RE: Web Part to display a list across columns

RE: Web Part to display a list across columns

Home Forums QuickApps Forum Web Part to display a list across columns RE: Web Part to display a list across columns

#7156
Anonymous
Anonymous
Participant

Hi,

n

I've tried out the same thing using jQuery but it didn't help out.

n

My list has below items:

n

Item1
Item2
Item3
Item4
Item5
Item6
Item7
Item8
Item9
Item10

n

n

Its displaying the result like this:
Item1          Item2          Item3          Item4          Item5

n

The order is correct. But its not displaying the rest of the items in next row. Please check the code below and suggest:

n

<script type='text/javascript'> var index = 0; var rowmax = 8;</script>
<script language="javascript" type="text/javascript">
var title = "";
var url = "";
$(document).ready(function () {

n

GetData();
//alert($('#tabk').find('td[colspan!=""]').length);

n

});

n

function GetData() {
$().SPServices({
operation: "GetListItems",
async: false,
listName: "TestFooter",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Link' /></ViewFields>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
AddRowToTable(title, url);
title = $(this).attr("ows_Title");
url = $(this).attr("ows_Link");
// alert(title);
//AddRowToTable(title, url);
});
}
});
}
function AddRowToTable(title, url) {
if (index == 0) {

n

index++;

n

$("#tabk").append("<tr>");

n

} else if (index <= 5) {

$("#tabk").append("<td><a href=" + url + ">" + title + "</a></td>");

n

index++;

n

} else {

n

index = 0;
$("#tabk").append("</tr>");
}
}
</script>
<div id="siteOwner">
<table id="tabk">

</table>
</div>

n

    

n