What Datatype is the Mapping Variable in SPServices?

Apr 15, 2013 at 8:29 PM
Edited Apr 15, 2013 at 8:30 PM
How would I pass in the mapping as a variable object?
Not to familiar with JSON/javascript arrary columns:
             
            function GetlistOps(myList, myList, myMap) {
                myJson = null;

                $().SPServices({
                    operation: "GetListItems",
                    async: false,
                    webUrl: myUrl,
                    listName: myList
                    completefunc: function (xData, Status) {

                        myJson = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({
                            mapping: {
                                ows_LinkFilename: { mappedName: "Filename", objectType: "Text" },
                            //instead pass in the myMap variable
                             }, // name, mappedName, objectType
                            includeAllAttrs: false
                        });
                     
                        return myJson

                    }// End of completefunc
                }); //End of SPService
            };
Coordinator
Apr 18, 2013 at 4:26 AM
BenJamN:

If I understand your question, you can set a var to to mappings that you want. something like:
var myMap = {ows_LinkFilename: { mappedName: "Filename", objectType: "Text" };
M.
Coordinator
Apr 18, 2013 at 4:28 AM
p.s. In JavaScript all vars are objects. JavaScript is not a strictly-typed language.

M.