Class: AssignmentBox

XV. AssignmentBox

An assignment box is a groupbox that manages the assignment of a set of available options to an object. For example, setting up the privileges that are associated with a role.
Derived from enyo.Scroller.

new AssignmentBox()

Source:

Extends

  • enyo.Scroller

Members

published :Object

Published fields
Type:
  • Object
Properties:
Name Type Description
assignedCollection XM.Collection The collection that backs this box. The model of the collection is the assignment (link) model.
assignedIds Array The ids of the assignable models. Cached for performance and recached whenever the assignedCollection is changed.
cacheName String The name of the cached collection if the collection is stored in the XM cache.
nameAttribute String The attribute of the label field to appear in the checkbox widget.
restrictedValues Array An array of the values that we want to see in this assignment box. Values not in this array will be suppressed. If this is null (as by default) then no suppression will occur.
segmentedCollections Array An array of collections, each of whom are a subset of totalCollection.
segments Array We allow the assignable checkboxes to be grouped by segment. If this array is length one then there is no segmentation, and the one value of the array becomes the header of the box. If the array is length zero then we dynamically generate the segments based on the incoming data. It must be overridden by the implementation to be something other than null, though.
modelName String The collection of all possible assignable models.
totalCollection XM.Collection The collection of all possible assignable models.
totalCollectionName String The name in the the XM namespace of the collection. Used to making new segmentedCollections.
translateLabels Boolean We want to translate the labels if they are hardcoded into our system (such as privileges) but not if they are user-defined.
type String Camelized name of assignable model. Used for drilling down from the assignment (link) model to the assignable model. It is important that this be the attribute in the assignment model that contains the assignable model.
query Object A query to filter the collection by
Source:

Methods

applyPostCheckFormatting()

Applies special formatting to a checkbox after it has been clicked, if applicable. This method should be overriden by the subkind if applicable.
Source:

checkboxChange()

Handles bubbled checkbox event changes and prevents them from bubbling further.
Source:

create()

Populates totalCollection field (either from the cache or through a fetch) and calls for the totalCollection to be segmentized.
Source:

fetch()

Refresh the `totalCollection`.
Source:

getAssignmentModel()

Creates a new assignment model to add to the assignedCollection. We rely on the subkinds to override this function, as implemetations are varied.
Source:

mapIds()

Updates the cache of assignedIds based on the assignedCollection.
Source:

setupCheckbox()

Sets up a checkbox: label, value, checkiness.
Source:

setupSegment()

Called by the segmentRepeater. Sets the header of the segment and awakens the checkboxRepeater.
Source:

setValue()

This is the method that the parent container will typically call to create this box. All logic and rendering flows from here.
Source:

tryToRender()

Render this AssignmentBox by firing off the segment repeater. We can only render if we know *both* what the options and and also what's already assigned. These both can happen asynchronously, which is why we have to check and only execute when both are done.
Source:

undercheckCheckbox()

Apply a half-ghosty underchecking style to the checkbox if we want to. Used here to denote that a privilege is grated via a role but not directly to a user.
Source: