Numeric properties should be specified as string properties in the template.
Properties that are expected to have numeric values can be associated with editors that are designed to work with numbers. These editors guarantee that the property is assigned a numeric value.
A numeric stepper enables content administrators to select a numeric value from a set of possible values by stepping through values or typing into an input field.
The numeric stepper provides a single-line input text field and a pair
of arrow buttons for stepping through values. If a user enters number that is
not a multiple of the
stepSize
property or is not in the range between the
maximum and minimum properties, this property is set to the nearest valid
value.
To add a numeric stepper to a template:
Insert an
<editors:NumericStepperEditor>
element within<BasicContentItemEditor>
.Specify additional attributes for the editor:
Attribute Description propertyName
Required. The name
of the string property that this editor is associated with. This property must be declared in the same template as the string editor.width
The width, in pixels, of the editor. The default width is 60. height
The height, in pixels, of the editor. The default height is 24. minValue
The minimum value of the property bound to this editor. The minValue
can be any number, including a fractional value. The default minimum value is 0.maxValue
The maximum value of the property bound to this editor. The maxValue
can be any number, including a fractional value. The default maximum value is 10.stepSize
The increment by which the property value is increased or decreased when a user clicks on the up or down arrows. The value must be a multiple of this number. The default step size is 1.
The following example shows the configuration for a numeric stepper:
<ContentTemplate xmlns="http://endeca.com/schema/content-template/2008" xmlns:xavia="http://endeca.com/schema/xavia/2010" xmlns:editors="editors" type="SidebarContent"> <!-- additional elements omitted from this example --> <ContentItem> <Name>Dimension Navigation</Name> <!-- additional elements omitted from this example --> <Property name="numRefinements"> <String>10</String> </Property> <Property name="maxNumRefinements"> <String>200</String> </Property> <!-- additional elements omitted from this example --> </ContentItem> <EditorPanel> <BasicContentItemEditor> <!-- additional elements omitted from this example --> <editors:NumericStepperEditor propertyName="numRefinements" label="Max. Refinements" maxValue="10000" enabled="true"/> <!-- additional elements omitted from this example --> <editors:NumericStepperEditor propertyName="maxNumRefinements" label="'More' Max. Refinements" maxValue="100000" enabled="true"/> </BasicContentItemEditor> </EditorPanel> </ContentTemplate>
A slider enables content administrators to select a numeric value by moving a slider between predefined endpoint values.
The current value of the slider is determined by the relative location of the thumb between the end points of the slider, corresponding to the slider's minimum and maximum values.
To add a slider to a template:
Insert an
<editors:SliderEditor>
element within<BasicContentItemEditor>
.Specify label attributes and additional attributes for the editor:
Attribute Description propertyName
Required. The name
of the string property that this editor is associated with. This property must be declared in the same template as the string editor.width
The width, in pixels, of the editor. The default width is 160. height
The height, in pixels, of the editor. The default height is 36. default
The default position of the slider thumb. By default, the thumb is set to 0. minValue
The minimum value of the property bound to this editor. The minValue
can be any number, including a fractional value. The default minimum value is 0.maxValue
The maximum value of the property bound to this editor. The maxValue
can be any number, including a fractional value. The default maximum value is 10.snapInterval
Specifies the increment value of the slider thumb as the user moves the thumb. A value of 0 means that the slider moves continuously between the minimum and maximum values. The default value is 0. tickInterval
The spacing of the tick marks. A value of 0 displays no tick marks. The default value is 0. precision
Number of decimal places to use for the property value and data tip text. A value of 0 means all values are rounded to the nearest integer. The default value is 0. labels
An array of strings to use for the slider labels. These labels display at the beginning and end of the track and, if there are more than two values, spaced evenly between the two ends. By default, the beginning and end of the slider track are labeled in Experience Manager with the minimum and maximum values.
The following example shows the configuration for a slider:
<ContentTemplate xmlns="http://endeca.com/schema/content-template/2008" xmlns:editors="editors" type="SidebarItem"> <!-- additional elements omitted from this example --> <!-- Define the content properties --> <ContentItem> <!-- additional elements omitted from this example --> <!-- define numeric properties as simple string properties --> <Property name="numRefinements"> <String>10</String> </Property> </ContentItem> <!-- Define editors for numeric properties --> <EditorPanel> <BasicContentItemEditor> <!-- additional elements omitted from this example --> <editors:SliderEditor propertyName="numRefinements" label="Number of refinements" minValue="10" maxValue="30" snapInterval="5" tickInterval="5" labels="10,15,20,25,30"/> </BasicContentItemEditor> </EditorPanel> </ContentTemplate>