Isaac
asked on
some list items not showing
I have the jQuery code below that is supposed to display all the items in a list but it only shows 28 of 65 list items. Anybody know why that is?
<style>
.tdBackGround {
background-image: url(../image/CSSGradient.gif);
BORDER-BOTTOM: #bfbfbf 1px solid;
text-align: center;
border-left: #bfbfbf 1px solid;
background-repeat: repeat-x;
white-space: nowrap;
color: white;
border-top: #bfbfbf 1px solid;
font-weight: bold;
border-right: #bfbfbf 1px solid;
}
</style>
<table id="DeliverableTbl" cellspacing="2" cellpadding="2" style="text-align:left;" width="100%" align="center">
<tr style="font-family:verdana;font-size:12px;font-weight:bold">
<td class="tdBackGround">Edit</td>
<td class="tdBackGround">Deliverable Name</td>
<td class="tdBackGround">Performer</td>
<td class="tdBackGround">CNID</td>
<td class="tdBackGround">FY</td>
<td class="tdBackGround">Activiy</td>
<td class="tdBackGround">Project</td>
<td class="tdBackGround">Product</td>
<td class="tdBackGround">Govt Lead</td>
<td class="tdBackGround">Performer POCs</td>
<td class="tdBackGround">Description</td>
<td class="tdBackGround">Start Date</td>
<td class="tdBackGround">End Date</td>
<td class="tdBackGround">Previous End Date(s)</td>
<td class="tdBackGround">Completion Date</td>
<td class="tdBackGround">Planned</td>
<td class="tdBackGround">Staff Months</td>
<td class="tdBackGround">Function</td>
<td class="tdBackGround">Status</td>
<td class="tdBackGround">Contract</td>
</tr>
</table>
<script type="text/javascript" src="../js/jquery-1.8.2.min.js" language="javascript"></script>
<script type="text/javascript" src="../js/jquery.SPServices-0.7.2.min.js" language="javascript"></script>
<script type="text/javascript" src="../js/jquery-ui-LatestVersion.js" language="javascript"></script>
<link rel="stylesheet" type="text/css" href="../Style/jquery-ui-LatestVersion.css">
<style>
.complete{
color:green;
font-family:arial
}
.inProgress{
color:gray;
font-family:arial
}
.notStarted{
color:blue;
font-family:arial
}
</style>
<script type="text/javascript">
$(document).ready(function() {
var currSiteUrl = $().SPServices.SPGetCurrentSite();
var soapEnv1 =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<soapenv:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>Deliverables</listName>" +
"<viewFields>" +
"<ViewFields>" +
"</ViewFields>" +
"</viewFields>" +
"</GetListItems>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
$.ajax(
{
url: currSiteUrl + "/_vti_bin/lists.asmx",
async: true,
type: "POST",
dataType: "xml",
data: soapEnv1,
complete: GetDeliverableData,
contentType: "text/xml; charset=\"utf-8\""
});
});
function GetDeliverableData(xData,status)
{
//alert(xData.responseXML.xml);
var statusColor="";
$(xData.responseXML).find("z\\:row").each(function()
{
$("#DeliverableTbl").append("<tr><td><a href=/editDeliverable.aspx?cid="+checkForNaN($(this).attr("ows_ID"))+"><img src='../image/edit.ico' title='Edit' height='25px' width='25px' border='0'></a></td><td>"+checkForUndefined($(this).attr("ows_Title"))+"</td><td>"+checkForUndefined($(this).attr("ows_Performer"))+"<td>"+checkForUndefined(parseInt($(this).attr("ows_CNID")))+"</td><td>"+checkForUndefined($(this).attr("ows_FY"))+"</td><td>"+checkForUndefined($(this).attr("ows_Activity"))+"</td><td>"+checkForUndefined($(this).attr("ows_Project"))+"</td><td>"+checkForUndefined($(this).attr("ows_Product"))+"</td><td>"+checkForUndefined($(this).attr("ows_GovtLead"))+"</td><td>"+checkForUndefined($(this).attr("ows_PerformerPOCs"))+"</td><td>"+checkForUndefined($(this).attr("ows_Description"))+"</td><td>"+checkForUndefined($(this).attr("ows_StartDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_EndDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_PreviousDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_CompletionDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_Planned"))+"</td><td>"+checkForUndefined($(this).attr("ows_StaffMonths"))+"</td><td>"+checkForUndefined($(this).attr("ows_Function"))+"</td><td>"+checkForUndefined($(this).attr("ows_Status"))+"</td><td>"+checkForUndefined($(this).attr("ows_Contracts"))+"</td></tr>");
});
}
function checkForUndefined(x){
return x === undefined ? "" : x;
}
function checkForNaN(x) {
return x === NaN ? "" : x;
}
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
</script>
Can you post the result of $(xData.responseXML).find( "z\\:row") .length?
If this number = 28 then either your response (coming from web service) or selector expression(("z\\:row") is not correct.
If your xml response is correct, please post it (xData.responseXML)and what nodes you are interested to fetch. Usually the selector only needs the node element name to fetch the correct nodes.
If this number = 28 then either your response (coming from web service) or selector expression(("z\\:row") is not correct.
If your xml response is correct, please post it (xData.responseXML)and what nodes you are interested to fetch. Usually the selector only needs the node element name to fetch the correct nodes.
ASKER
It's 28 which is wrong.
What''s the best way to provide the xData.responseXML?
What''s the best way to provide the xData.responseXML?
ASKER
The number is actually 30 which is still wrong.
As per my previous comment: Please post your xData.responseXML content and check that you have the 65 entries inside the xml string. (Copy the string to text file and search there for the element node you are after. If the xml string contains the 65 entries then selector expression(("z\\:row") is incorrect else your web service response is not providing the right answer and you must fix your web service code.
Which xml node are you after in the response xml?
Which xml node are you after in the response xml?
ASKER
I'm after about 20 nodes:
ASKER
how do I get the xData.responseXML into a text file?
I tried the following but no go:
<label id="test"></label>
.
.
.
.$("#test").append(xData.r esponseXML .xml);
I tried the following but no go:
<label id="test"></label>
.
.
.
.$("#test").append(xData.r
Just put a breakpoint in the JS code on this line:
$(xData.responseXML).find( "z\\:row") .each(func tion()
when debugger stops at this breakpoint:
$(xData.responseXML).find(
when debugger stops at this breakpoint:
Press Shift+F9, quick watch dialog shows up with expresion set to "xData.responseXML"
Copy the value shown on dialog and paste to a text file.
ASKER
Hi,
I tried the break before and after the JS code, $(xData.responseXML).find( "z\\:row") .each(func tion(), but I kept getting an error about it being outside the loop.
I tried the break before and after the JS code, $(xData.responseXML).find(
function GetDeliverableData(xData,status)
{
var statusColor="";
$(xData.responseXML).find("z\\:row").each(function()
{
break;
you do not need break statement, if you a running VS, just press F9 on the line and VS will add a break point for you. (if you are not running in VS add break at line 5)
ASKER
Sorry for the late response. I am not using VS so I added the break at line 5 and got the following error:
Also, here's my sp site. I finished creating it so you can see. If you compare the page and the document library, you'll see that it's not rendering.
http://issharepoint.com/EE/Site%20Pages/DeliverWebpart.aspx
Also, here's my sp site. I finished creating it so you can see. If you compare the page and the document library, you'll see that it's not rendering.
http://issharepoint.com/EE/Site%20Pages/DeliverWebpart.aspx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
I'll try your suggestions. I'm using IE 8.
>>Is there any particular reason for using xml instead of JSON?<<
I just learned about JSON last week and understand it but not sure how to use it in this instance. Please, how can I use JSON in this instance? Thanks!
I'll try your suggestions. I'm using IE 8.
>>Is there any particular reason for using xml instead of JSON?<<
I just learned about JSON last week and understand it but not sure how to use it in this instance. Please, how can I use JSON in this instance? Thanks!
ASKER
>>Note: If you need further help I need the xml response with your valid parameters or add a button on your page that calls the web service with the parameters of the win form app so that we are absolutely sure your web service is returning the right amount of objects.<<
Could you please give me step by step guidance on this? How can I get you the xml response? Below is my code if that would help...
Could you please give me step by step guidance on this? How can I get you the xml response? Below is my code if that would help...
<style>
.tdBackGround {
background-image: url(http://issharepoint.com/EE/image/cssgradient.gif);
BORDER-BOTTOM: #bfbfbf 1px solid;
text-align: center;
border-left: #bfbfbf 1px solid;
background-repeat: repeat-x;
white-space: nowrap;
color: white;
border-top: #bfbfbf 1px solid;
font-weight: bold;
border-right: #bfbfbf 1px solid;
}
</style>
<table id="DeliverableTbl" cellspacing="2" cellpadding="2" style="text-align:left;" width="100%" align="center">
<tr style="font-family:verdana;font-size:12px;font-weight:bold">
<td class="tdBackGround">Edit</td>
<td class="tdBackGround">Deliverable Name</td>
<td class="tdBackGround">CNID</td>
<td class="tdBackGround">FY</td>
<td class="tdBackGround">Activiy</td>
<td class="tdBackGround">Project</td>
<td class="tdBackGround">Product</td>
<td class="tdBackGround">Govt Lead</td>
<td class="tdBackGround">Performer POCs</td>
<td class="tdBackGround">Description</td>
<td class="tdBackGround">Start Date</td>
<td class="tdBackGround">End Date</td>
<td class="tdBackGround">Previous End Date(s)</td>
<td class="tdBackGround">Completion Date</td>
<td class="tdBackGround">Planned</td>
<td class="tdBackGround">Staff Months</td>
<td class="tdBackGround">Function</td>
<td class="tdBackGround">Status</td>
<td class="tdBackGround">Contracts</td>
</tr>
</table>
<script type="text/javascript" src="http://issharepoint.com/EE/js/jquery-1.8.2.min.js" language="javascript"></script>
<script type="text/javascript" src="http://issharepoint.com/EE/js/jquery.SPServices-0.7.2.min.js" language="javascript"></script>
<script type="text/javascript" src="http://issharepoint.com/EE/js/jquery-ui-LatestVersion.js" language="javascript"></script>
<link rel="stylesheet" type="text/css" href="http://issharepoint.com/EE/Styles/jquery-ui-LatestVersion.css">
<style>
.complete{
color:green;
font-family:arial
}
.inProgress{
color:gray;
font-family:arial
}
.notStarted{
color:blue;
font-family:arial
}
</style>
<script type="text/javascript">
$(document).ready(function() {
//alert("Hello");
var currSiteUrl = $().SPServices.SPGetCurrentSite();
//alert(currSiteUrl);
var status = getUrlVars()["status"];
//var qry = "<Query><Where><Eq><FieldRef Name='ows_Status' /><Value Type='Lookup'>"+status+"</Value></Eq></Where></Query>";
if (status == "Complete" || status == "In Progress" || status == "Not Started")
{
var soapEnv1 =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<soapenv:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>Deliverables</listName>" +
"<query><Query><Where><Eq><FieldRef Name='Status' /><Value Type='Text'>"+status+"</Value></Eq></Where></Query></query>" +
"<viewFields>" +
"<ViewFields>" +
"</ViewFields>" +
"</viewFields>" +
"</GetListItems>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
}
else
{
var soapEnv1 =
"<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" +
"<soapenv:Body>" +
"<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" +
"<listName>Deliverables</listName>" +
"<viewFields>" +
"<ViewFields>" +
"</ViewFields>" +
"</viewFields>" +
"</GetListItems>" +
"</soapenv:Body>" +
"</soapenv:Envelope>";
}
$.ajax(
{
url: currSiteUrl + "/_vti_bin/lists.asmx",
async: true,
type: "POST",
dataType: "xml",
data: soapEnv1,
complete: GetDeliverableData,
contentType: "text/xml; charset=\"utf-8\""
});
});
function GetDeliverableData(xData,status)
{
//alert(xData.responseXML.xml);
var statusColor="";
//break;
$(xData.responseXML).find("z\\:row, row").each(function()
{
if ($(this).attr("ows_Status")=="Complete")
{
statusColor="complete";
}
else if ($(this).attr("ows_Status")=="Not Started")
{
statusColor="notStarted";
}
else if ($(this).attr("ows_Status")=="In Progress")
{
statusColor="inProgress";
}
$("#DeliverableTbl").append("<tr class='"+statusColor+"'><td><a href=http://issharepoint.com/EE/Site%20Pages/editDeliverable.aspx?cid="+checkForNaN($(this).attr("ows_ID"))+">Edit</td><td>"+checkForUndefined($(this).attr("ows_Title"))+"</td><td>"+checkForUndefined(parseInt($(this).attr("ows_CNID")))+"</td><td>"+checkForUndefined($(this).attr("ows_FY"))+"</td><td>"+checkForUndefined($(this).attr("ows_Activity"))+"</td><td>"+checkForUndefined($(this).attr("ows_Project"))+"</td><td>"+checkForUndefined($(this).attr("ows_Product"))+"</td><td>"+checkForUndefined($(this).attr("ows_GovtLead"))+"</td><td>"+checkForUndefined($(this).attr("ows_PerformerPOCs"))+"</td><td>"+checkForUndefined($(this).attr("ows_Description"))+"</td><td>"+checkForUndefined($(this).attr("ows_StartDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_EndDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_PreviousDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_CompletionDate"))+"</td><td>"+checkForUndefined($(this).attr("ows_Planned"))+"</td><td>"+checkForUndefined($(this).attr("ows_StaffMonths"))+"</td><td>"+checkForUndefined($(this).attr("ows_Function"))+"</td><td>"+checkForUndefined($(this).attr("ows_Status"))+"</td><td>"+checkForUndefined($(this).attr("ows_Contracts"))+"</td></tr>");
});
}
function checkForUndefined(x){
return x === undefined ? "" : x;
}
function checkForNaN(x) {
return x === NaN ? "" : x;
}
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
</script>
ASKER
>>$(xData.responseXML).fin d("z\\:row , row").each(function() <<
Still get the same result with the change
Still get the same result with the change
Read the previous sitepoint link steps 2, 3 and 4. (All detailed steps are there the only difference is that instead of a grid you can use a label to display the xml results (encoding the results of course))
If you can not make the test app:
1) Use Fiddler tool to capture the AJAX response and post it back checking that server is returning the number of z:row nodes you expect.
2) Add a button to your test page and state how many z:row nodes you are expecting and which browser you are testing. (I use only IE and FF)
If you can not make the test app:
1) Use Fiddler tool to capture the AJAX response and post it back checking that server is returning the number of z:row nodes you expect.
2) Add a button to your test page and state how many z:row nodes you are expecting and which browser you are testing. (I use only IE and FF)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did not use the soap version and solved my problem.
In the each function is it running the 65 times and just not appending?