This project is read-only.

SummaryLink object

Namespace: oPB.SummaryLinkStore
Constructor: oPB.SummaryLinkStore.SummaryLink(options)

Options is an optional argument to the constructor. It can be used to provide the constructor with initial values for properties on the instance that will be created. The following example shows all the properties which can be set this way, but each property is optional:
var instance = new oPB.SummaryLinkStore({
    beginColumn: false,
    description: "a description",
    group: "{00000000-0000-0000-0000-000000000000}",
    groupStyle: "Default",
    imageUrl: "",
    imageUrlAltText: "",
    isGroupHeader: false,
    linkStore: summaryLinkStoreInstance, //for internal use.
    linkToolTip: "",
    linkUrl:"",
    loginName: "",
    openInNewWindow: false,
    sipAddress: "",
    style: "",
    title: ""
});

Properties

The SummaryLinkStore instance will have properties which can be accessed through accessor functions. If no argument is provided to the accessor, the property value is returned. If an argument is provided, that argument may be validated. If the argument is not a valid value for the property, the accessor may throw an error. If a valid value was provided, the property is set to that value.

Note that some accessors will have custom behaviour.

beginColumn
Validation: must be a boolean
Category: XML
Description:
Can be set to clarify that during deserialize of the SummaryLinkStore, this SummaryLink was begin column. To check if the current SummaryLink instance is a BeginColumn, use isBeginColumn method in stead.

description
Validation: must be a string, no longer than 1000 characters.
Category: View
Description:
Sets the value for description of the SummaryLink (similar to description as used in UI of Summary Link web part).

group
Validation: must be a string
Category: XML
Description:
This refers to the group to which the current SummaryLink belongs. This can be the title of the group or the ID (guid) of the group. How ever the Guid is only used by the library, in the SummaryLinkStore XML the title of the group will be used (multiple groups with the same name can 'confuse' the Summary Link web part).
To check if the value of group would be a valid guid, you can use the isGuid function:
var booleanValue = instance.group.isGuid();
To set the value of group to undefined, use the clear function:
instance.group.clear();

groupStyle
Validation: must be a string
Category: View
Description:
GroupStyle of the summary link.

imageUrl
Validation: must be a string
Category: View
Description:
Sets the value for imageUrl of the SummaryLink (similar to imageUrl as used in UI of Summary Link web part).

imageUrlAltText
Validation: must be a string, no longer than 500 characters
Category: View
Description:
Sets the value for imageUrlAltText of the SummaryLink (similar to imageUrlAltText as used in UI of Summary Link web part).

isGroupHeader
Validation: only acts as a getter.
Category: Type
Description:
If set to true, this SummaryLink instance represents a group in stead of a link, it's value can be provided to the constructor when creating the instance.

isPeopleLink
Validation: only acts as a getter.
Category: Type
Description:
If the SummaryLink has a value for loginName property, it is assumed this link is a PeopleLink (in the UI you can configure a link to refer to a user).

linkStore
Validation: must be an instance of oPB.SummaryLinkStore
Category: Context
Description:
For internal use, changing this value is not supported.

linkToolTip
Validation: must be a string, no longer than 500 characters
Category: View
Description:
Sets the value for linkToolTip of the SummaryLink (similar to linkToolTip as used in UI of Summary Link web part).

linkUrl
Validation: must be a string
Category: View
Description:
Sets the value for linkUrl of the SummaryLink (similar to linkUrl as used in UI of Summary Link web part).

loginName
Validation: must be a string
Category: View
Description:
If this should be a link to a person (PeopleLink), set the login name of the user to link to.

openInNewWindow
Validation: must be a boolean
Category: View
Description:
Sets the value for openInNewWindow of the SummaryLink (similar to openInNewWindow as used in UI of Summary Link web part).

order
Validation: should be a number, advanced behavior.
Category: Context
Description:
Calculates the (current or new) order value for the SummaryLink.

parent
Validation: only acts as a getter.
Category: Context
Description:
Returns the object that acts as the owner of this SummaryLink (for instance another SummaryLink which is a GroupHeader, or the instance of the SummaryLinkStore).

sipAddress
Validation: must be a string
Category: View
Description:
Sets the value for sipAddress of the SummaryLink (similar to sipAddress as used in UI of Summary Link web part).

style
Validation: must be a string
Category: View
Description:
Sets the value for style of the SummaryLink (similar to style as used in UI of Summary Link web part).
To set the value of style to undefined, use the clear function:
instance.style.clear();

title
Validation: must be a string, no longer than 500 characters
Category: View
Description:
Sets the value for style of the title (similar to title as used in UI of Summary Link web part).

id
Validation: only acts as a getter.
Category: Context
Description:
Returns an unique identifier for this SummaryLink, for usage in JavaScript, not in XML.

summaryLinks
Validation: collection is managed by the SummaryLinkCollection object.
Category: collection
Description: SummaryLinkCollection for details.

methods

With methods, I mean the functions on an instance which are not accessors to a property.

(boolean) isBeginColumn(options)
This function is intended to be used while building a string from the SummaryLinkStore data. Because the build function will iterate over all the data in the SummaryLinkStore, you are able to count the number of SummaryLink instances and how many of them are group headers.

The isBeginColumn function will require this data in the following way:
var byReference = {};
var isBeginColumn = summaryLinkInstance.isBeginColumn({
    context: {
        order: 1, //Number of SummaryLink instances counted so far (including self)
        groupNr: 1 //Number of SummaryLink instances counted so var that where group header (including self, if summaryLinkInstance is a group header)
    },
    output: byReference
});
if(isBeginColumn) //if: is summaryLinkInstance the first group in a column
{
    alert("I am on top of column " + byReference.columnNr);
}
else
{
    alert("I am somewhere in column " + byReference.columnNr);
}

As the code above should clarify, this function can both be used to find out if a SummaryLink instance is the top group of a column, and in which column the group header should be (if the SummaryLink instance is a group header).

(undefined) build (options)
Options is a required argument. It must have a property called "builder" with a function assigned to it.

The build function will call the provided builder function from each instance, usually multiple times. The goal is to allow the builder function to easily build a string that represents the structure of the data. This function can, for example, be useful to build HTML that represents the data.

(result object) serialize()
options is an optional argument, intended for internal use. This function is targeted for internal use as well, but it is available to you.

The result object will have a property called "strings", which will be an array. If you call result.strings.join(''); then you'll have an XML representation of the collection of SummaryLinks.

Last edited Apr 24, 2015 at 7:30 PM by pbvansplunter, version 15