开发者

Blank page for jquery.SPServices that list a sharepoint List

I have a SharePoint List that I wish to view it on a custom aspx file.

The SharePoint List is named - "AM_Code"

Inside the List, there are multiple columns but I just want those rows with the column 'Title' that is not null.

The data will then be displayed on the screen.

The code as follows:

<%@ Page Language="C#" %>
<html dir="ltr">

<head runat="server">
<META name="WebPartPageExpansion" content="full">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Testing JQuery with Sharepoint List</title>
</head>

<body>

<form id="form1" runat="server">
</form>

<script type="text/javascript" language="javascript"开发者_如何学C src="jquery-1.6.2.min.js"></script>
<script type="text/javascript" language="javascript" src="jquery.SPServices-0.6.2.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
  $().SPServices({
operation: "GetListItems",
async: false,
listName: "AM_Code",
CAMLViewFields: "<Query><Where><IsNotNull><FieldRef Name="Title" /></IsNotNull></Where><OrderBy><FieldRef Name="Title" Ascending="True" /></OrderBy></Query>",
completefunc: function (xData, Status) {
  $(xData.responseXML).find("[nodeName='z:row']").each(function() {
    var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
    $("#tasksUL").append(liHtml);
  });
}
  });
});
</script>
<ul id="tasksUL"/>
</body>
</html>

However nothing was being displayed. Please advise if I have miss anything.


CAMLViewFields: "<Query><Where><IsNotNull><FieldRef Name="Title" /></IsNotNull></Where><OrderBy><FieldRef Name="Title" Ascending="True" /></OrderBy></Query>",

this doesn't seem right to me


Actually I found my own answer.

The CAMLViewFields contain the following in order to work:

"<Query><Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where><OrderBy><FieldRef Name='Title' Ascending="True" /></OrderBy></Query>",

Hope it help anyone who is also looking for such solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜