dijit/form/HorizontalRuleLabels.js

  • Provides:

    • dijit.form.HorizontalRuleLabels
  • dijit.form.HorizontalRuleLabels

    • type
      Function
    • chains:
      • dijit.form.HorizontalRule: (prototype)
      • dijit.form.HorizontalRule: (call)
    • summary
      Labels for `dijit.form.HorizontalSlider`
  • dijit.form.HorizontalRuleLabels.templateString

    • summary
  • dijit.form.HorizontalRuleLabels.labelStyle

    • type
      String
    • summary
      CSS style to apply to individual text labels
  • dijit.form.HorizontalRuleLabels.labels

    • type
      String[]
    • summary
      Array of text labels to render - evenly spaced from left-to-right or bottom-to-top.
      Alternately, minimum and maximum can be specified, to get numeric labels.
  • dijit.form.HorizontalRuleLabels.numericMargin

    • type
      Integer
    • summary
      Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified
  • dijit.form.HorizontalRuleLabels.minimum

    • summary
  • dijit.form.HorizontalRuleLabels.maximum

    • summary
  • dijit.form.HorizontalRuleLabels.constraints

    • type
      Object
    • summary
  • dijit.form.HorizontalRuleLabels._positionPrefix

    • summary
  • dijit.form.HorizontalRuleLabels._labelPrefix

    • summary
  • dijit.form.HorizontalRuleLabels._suffix

    • summary
  • dijit.form.HorizontalRuleLabels._calcPosition

    • type
      Function
    • parameters:
      • pos: (typeof )
    • source: [view]
        return pos;
    • summary
      Returns the value to be used in HTML for the label as part of the left: attribute
    • tags:
  • dijit.form.HorizontalRuleLabels._genHTML

    • type
      Function
    • parameters:
      • pos: (typeof )
      • ndx: (typeof )
    • source: [view]
        return this._positionPrefix + this._calcPosition(pos) + this._positionSuffix + this.labelStyle + this._labelPrefix + this.labels[ndx] + this._suffix;
    • summary
  • dijit.form.HorizontalRuleLabels.getLabels

    • type
      Function
    • source: [view]
      define("dijit/form/HorizontalRuleLabels", ["dojo", "dijit", "dijit/form/HorizontalRule"], function(dojo, dijit) {


      dojo.declare("dijit.form.HorizontalRuleLabels", dijit.form.HorizontalRule,
      {
       // summary:
       //  Labels for `dijit.form.HorizontalSlider`


       templateString: '
      ',


       // labelStyle: String
       //  CSS style to apply to individual text labels
       labelStyle: "",


       // labels: String[]?
       //  Array of text labels to render - evenly spaced from left-to-right or bottom-to-top.
       //  Alternately, minimum and maximum can be specified, to get numeric labels.
       labels: [],


       // numericMargin: Integer
       //  Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified
       numericMargin: 0,


       // numericMinimum: Integer
       //  Leftmost label value for generated numeric labels when labels[] are not specified
       minimum: 0,


       // numericMaximum: Integer
       //  Rightmost label value for generated numeric labels when labels[] are not specified
       maximum: 1,


       // constraints: Object
       //  pattern, places, lang, et al (see dojo.number) for generated numeric labels when labels[] are not specified
       constraints: {pattern:"#%"},


       _positionPrefix: '
      ',
       _suffix: '
      ',


       _calcPosition: function(pos){
        // summary:
        //  Returns the value to be used in HTML for the label as part of the left: attribute
        // tags:
        //  protected extension
        return pos;
       },


       _genHTML: function(pos, ndx){
        return this._positionPrefix + this._calcPosition(pos) + this._positionSuffix + this.labelStyle + this._labelPrefix + this.labels[ndx] + this._suffix;
       },


       getLabels: function(){
        // summary:
        //  Overridable function to return array of labels to use for this slider.
        //  Can specify a getLabels() method instead of a labels[] array, or min/max attributes.
        // tags:
        //  protected extension


        // if the labels array was not specified directly, then see if
    • children were
        var labels = this.labels;
        if(!labels.length){
         // for markup creation, labels are specified as child elements
         labels = dojo.query("> li", this.srcNodeRef).map(function(node){
          return String(node.innerHTML);
         });
        }
        this.srcNodeRef.innerHTML = '';
        // if the labels were not specified directly and not as
    • children, then calculate numeric labels
        if(!labels.length && this.count > 1){
         var start = this.minimum;
         var inc = (this.maximum - start) / (this.count-1);
         for(var i=0; i < this.count; i++){
          labels.push((i < this.numericMargin || i >= (this.count-this.numericMargin)) ? '' : dojo.number.format(start, this.constraints));
          start += inc;
         }
        }
        return labels;
  • summary
    Overridable function to return array of labels to use for this slider.
    Can specify a getLabels() method instead of a labels[] array, or min/max attributes.
  • dijit.form.HorizontalRuleLabels.postMixInProperties

    • type
      Function
    • source: [view]
        this.inherited(arguments);
        this.labels = this.getLabels();
        this.count = this.labels.length;
    • summary
  • dijit.form.HorizontalRuleLabels.constraints.pattern

    • summary
  • dijit.form.HorizontalRuleLabels.srcNodeRef.innerHTML

    • summary
  • dijit.form.HorizontalRuleLabels.count

    • summary
  • dijit.form

    • type
      Object
    • summary
  • dijit

    • type
      Object
    • summary