Quantcast
Viewing all articles
Browse latest Browse all 6517

New Post: Single List Item

alibby,

I would be getting the ID from the Item that I clicked on, for example, clicking from a List title. Anyways I am halfway there or closer. I completely spaced on this, I do not know how I could have completely forgotten about the CAMLQuery that you can add to GetListItems! While I am embarrassed, I am glad I found a closer path to a solution. The trick now is finding a way to assignt he variable a "clicked" ID. Check the example below:

FYI, I had to use the jQuery slice() function because when referencing a lookup, it gives me 3 character in font of my lookup result: 3;#. I am not sure if there is a cleaner way around this.
$().SPServices({
        operation: 'GetListItems',
        async: false,
        debug: true,
        listName: 'IT Assets',
        CAMLViewFields: '<ViewFields><FieldRef Name="Location" /></ViewFields>',
        CAMLQuery: '<Query><Where><Eq><FieldRef Name="ID"/><Value Type="Counter">1</Value></Eq></Where></Query>',
        completefunc: function(xData, Status) {
            $(xData.responseXML).SPFilterNode("z:row").each(function() {
                alert($(this).attr("ows_Location").slice(3));
                alert($(this).attr("ows_ID"));
            });
        }
    });

Viewing all articles
Browse latest Browse all 6517

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>