I have a SP 2010 list which I need to filter (with AJAX) based on multiple user requirements (dates, number of attendees, room requirements, etc), each corresponding to separate columns. Next, allow the user to select a remaining row which they want, and give them an option to select and update that row.

I am using SP Services to do the filtering, but only with a single criteria at the moment, but I do not know the best strategy to accomplish the rest of what I am trying to achieve here.

Below is the code I have for the filtering I have in place atm:


    operation: "GetListItems",
    async: true,
    debug: true,
    listName: "Available_Rooms",
    maxResults: 11,
    CAMLRowLimit: 11,
    completefunc: function (xData, Status) {

        var JsonObject = $(xData.responseXML).SPFilterNode('z:row').SPXmlToJson({
                mapping: {
                    ows_RoomCapacity: { mappedName: "RoomCapacity", objectType: "Number" }
                includeAllAttrs: true,
                removeOws: true,
                sparse: true 

    "pageLength": 11,
    "bAutoWidth": true,
    "bDestroy": true,
    "bProcessing": true,
    "bLoadingRecords": 'Please wait - loading...',
    "bFilter": true,
    "deferRender": true,
    "responsive": true, 
    "aaData": JsonObject,
    "aoColumnDefs": [
        { "mData": "RoomCapacity", "aTargets":  [ 0 ] },
        { "mData": "DisplayName", "aTargets":  [ 1 ] },
        { "mData": "RoomDeptOwner", "aTargets":  [ 2 ] },
        { "mData": "RoomType", "aTargets":  [ 3 ] },
        { "mData": "Title", "aTargets":  [ 4 ] },
        { "mData": "VTC", "aTargets":  [ 5 ] },
        { "mData": "Projector", "aTargets":  [ 6 ] }


I'm not asking for someone to solve my problem for me, but I'd love it if they could point me in the right direction or recommend some tools I could use to solve this that would be amazing! Thanks in advance.


With SPServices you can specify a CAMLQuery parameter (see options listed for the GetListItems method here), and build your query based on your criteria.

CAMLQuery: "<Query><Where><Eq><FieldRef Name='Status'/><Value Type='Text'>Active</Value></Eq></Where></Query>"

If you need help building your CAML, there's a good utility called CAMLQueryHelper (CodePlex; GitHub).

However, even Marc (the author) will tell you things are going toward REST (SPServices uses SOAP), so if you have the opportunity to do so, I would suggest giving making a REST query a shot here, via the _api/web/lists/getByTitle('Your List Name')/Items?$filter= method. You can see more about OData operations (like $filter) here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.