0

I need to access column properties with jquery/SPServices from client side.

For instance, I have the below code. The below works perfectly, it allows me to access all rows and loop through them the way I want. But it will allow me to access only the FIELD value by default. And not the column it originates from.

  $().SPServices({
            operation: "GetListItems",
                async: false,
                listName: "linkListHomePage",
                //CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='EncodedAbsUrl'/></ViewFields>",

                CAMLQueryOptions: "<QueryOptions><ViewAttributes Scope='RecursiveAll'/></QueryOptions>",

                completefunc: function (xData, Status) {

                    $(xData.responseXML).SPFilterNode("z:row").each(function() {

                        var thisLink   = $(this).attr('ows_URL');//
                        var thisCategory = $(this).attr('ows_linkCategory');                        var thisLinkDescription = $(this).attr('ows_Comments');                            

                        var fileObject = {
                            url: thisLink,
                            category: thisCategory,
                            notes: thisLinkDescription 

                        };
                        listOfFiles.push(fileObject);



                    });
                }
            });

Now I would to modify the above code in a way where

  var thisCategory = $(this).attr('ows_linkCategory'); 

Would be equal to something like this:

 var thisCategory = $(this).attr('ows_linkCategory').description;

Now of course the above won't work it's just to show the idea of what I try to achieve. I've spent several hours yesterday and today trying to figure it out, modifying the CAMLQueryOptions, trying to find workarounds - but there is just no way for me to find a solution.

Below is a screenshot of the field i try to get: sharepoint image

The above is just an example.

I need this property as I have a sharepoint list where each column == contact emails/phones or customer name or customer statement settings for instance and each row == customer.

I will display those in HTML tables.Those tables will be generated dynamically with one HTML table per unique description defined in the description field.

So if for a list with 15 columns we have in the description field 3 times "Dashboard ' and 7 times "Cotact list" and 5 times"Statement details "then for each row we will generate one "Dashboard" table and 1 "Contact list" and one "Dashboard".

If it's imposible to access column properties with SPServices I will simply have to force the users to enter the category name within special characters directly in the column field value but I really want to avoid it. It will make the whole thing a hell lot messier.

Your Answer

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

Browse other questions tagged or ask your own question.