Monday, August 17, 2015

SPJS-utility.js updated to v1.250 BETA 1

This version splits up “getFieldValue” and “setFieldValue” in separate functions for each of the field types. You still use them as before, but for advanced users you can now override the function for each individual field type.

In this new function layout you can for example override the function “getFieldValue_SPFieldText” to change how “getFieldValue” returns the value for a field of type “Single line of text”:

spjs.utility.getFieldValue_SPFieldText = function(a){
        return spjs.$(spjs.utility.data.fields[a.fin]).find('input').val();
}

This new layout will also let you add support for new file types in “getFieldValue” and “setFieldValue” by adding a function like this for “set”:

spjs.utility.setFieldValue_SPField[*****] = function(a){
        // change [*****] with the field type of your field, and add your custom getFieldValue logic here.
}

and like this for “get”:

spjs.utility.setFieldValue_SPField[*****] = function(a){
        // change [*****] with the field type of your field, and add your custom getFieldValue logic here.
}

Post any questions in the forum.

Keep in mind that this version id BETA and should not be used in a production environment.

by Alexander Bautz via SharePoint JavaScripts

No comments:

Post a Comment