Tuesday, 30 June 2015

SPServices : GetListItmes : Get Total Count of the Items

To Get the Total Number of items from the custom list which satisfy our caml query, the code is as below :

var queryText = "<Query><Where><Eq><FieldRef Name='OfficeType' /><Value Type='Lookup'>"+OfficeType+"</Value></Eq></Where></Query>";

$().SPServices({
        operation: "GetListItems",
        listName: "FacilityStatus",
        async: false,
        CAMLQuery: queryText,
        completefunc: function (xData, status) {          
            itemCount = $(xData.responseXML).SPFilterNode("rs:data").attr("ItemCount");           
        }
     
   
    });
 
    return itemCount ;
           }

No comments:

Post a Comment