inputEx Documentation
Back to homepage
inputEx Documentation
> SliderField.js
0.2.2
This is the source view for SliderField.js
(function () { var inputEx = YAHOO.inputEx,lang=YAHOO.lang; /** * @class Create a slider using YUI widgets * @extends inputEx.Field * @constructor * @param {Object} options inputEx.Field options object */ inputEx.SliderField = function(options) { inputEx.SliderField.superclass.constructor.call(this,options); }; YAHOO.lang.extend(inputEx.SliderField, inputEx.Field, /** * @scope inputEx.SliderField.prototype */ { /** * Set the classname to 'inputEx-SliderField' * @param {Object} options Options object (inputEx inputParams) as passed to the constructor */ setOptions: function(options) { inputEx.SliderField.superclass.setOptions.call(this, options); this.options.className = options.className ? options.className : 'inputEx-SliderField'; this.options.minValue = lang.isUndefined(options.minValue) ? 0 : options.minValue; this.options.maxValue = lang.isUndefined(options.maxValue) ? 100 : options.maxValue; this.options.displayValue = lang.isUndefined(options.displayValue) ? true : options.displayValue; }, /** * render a slider widget */ renderComponent: function() { this.sliderbg = inputEx.cn('div', {id: YAHOO.util.Dom.generateId(), className: 'inputEx-SliderField-bg'}); this.sliderthumb = inputEx.cn('div', {className: 'inputEx-SliderField-thumb'} ); this.sliderbg.appendChild(this.sliderthumb); this.fieldContainer.appendChild(this.sliderbg); if(this.options.displayValue) { this.valueDisplay = inputEx.cn('div', {className: 'inputEx-SliderField-value'}, null, String(this.options.minValue) ); this.fieldContainer.appendChild(this.valueDisplay); } this.fieldContainer.appendChild( inputEx.cn('div',null,{clear: 'both'}) ); this.slider = YAHOO.widget.Slider.getHorizSlider(this.sliderbg, this.sliderthumb, 0,100); }, initEvents: function() { // Fire the updated event when we released the slider // the slider 'change' event would generate too much events (if used in a group, it gets validated too many times) this.slider.on('slideEnd', this.fireUpdatedEvt, this, true); // Update the displayed value if(this.options.displayValue) { this.updatedEvt.subscribe( function(e,params) { var val = params[0]; this.valueDisplay.innerHTML = val; }, this, true); } }, /** * Function to set the value * @param {Any} value The new value * @param {boolean} [sendUpdatedEvt] (optional) Wether this setValue should fire the updatedEvt or not (default is true, pass false to NOT send the event) */ setValue: function(val, sendUpdatedEvt) { var v = val; if(v < this.options.minValue) { v = this.options.minValue; } if(v > this.options.maxValue) { v = this.options.maxValue; } var percent = Math.floor(v-this.options.minValue)*100/this.options.maxValue; this.slider.setValue(percent); inputEx.SliderField.superclass.setValue.call(this, val, sendUpdatedEvt); }, /** * Get the value from the slider * @return {int} The integer value */ getValue: function() { var val = Math.floor(this.options.minValue+(this.options.maxValue-this.options.minValue)*this.slider.getValue()/100); return val; } }); /** * Register this class as "slider" type */ inputEx.registerType("slider", inputEx.SliderField); })();
Pages
Index
Getting Started
Overview
Markup structure
Migrate from 0.1.0
Field development
DOM functions
Internationalization
Visualization
Examples
Classes
(treeview)
inputEx
inputEx.AutoComplete
inputEx.BirthdateField
inputEx.CheckBox
inputEx.ColorField
inputEx.ColorField2
inputEx.CombineField
inputEx.DateField
inputEx.DatePickerField
inputEx.DateSplitField
inputEx.DateTimeField
inputEx.DSSelectField
inputEx.EmailField
inputEx.Field
inputEx.FileField
inputEx.Form
inputEx.formForMethod
inputEx.FrenchDate
inputEx.FrenchPhone
inputEx.generateServiceForm
inputEx.Group
inputEx.HiddenField
inputEx.ImagemapField
inputEx.InPlaceEdit
inputEx.IntegerField
inputEx.IPv4Field
inputEx.JsonSchema
inputEx.JsonSchema.Builder
inputEx.ListField
inputEx.MapField
inputEx.MenuField
inputEx.MultiAutoComplete
inputEx.MultiSelectField
inputEx.NumberField
inputEx.PairField
inputEx.PasswordField
inputEx.RadioButton
inputEx.RadioField
inputEx.RTEField
inputEx.SelectField
inputEx.SliderField
inputEx.StringField
inputEx.Textarea
inputEx.TimeField
inputEx.TreeField
inputEx.TypeField
inputEx.UneditableField
inputEx.UpperCaseField
inputEx.UrlField
inputEx.VectorField
inputEx.widget
inputEx.widget.DataTable
inputEx.widget.DDList
inputEx.widget.DDListItem
inputEx.widget.Dialog
inputEx.widget.InputExCellEditor
inputEx.widget.JsonTreeInspector
Files
AutoComplete.js
BirthdateField.js
CheckBox.js
ColorField.js
ColorField2.js
CombineField.js
DataTable-beta.js
DateField.js
DatePickerField.js
DateSplitField.js
DateTimeField.js
ddlist.js
Dialog-beta.js
DSSelectField.js
EmailField.js
Field.js
FileField-beta.js
Form.js
fr.js
FrenchDate.js
FrenchPhone.js
Group.js
HiddenField.js
ImagemapField.js
InPlaceEdit.js
inputex-loader.js
inputex-rpc.js
inputex.js
IntegerField.js
IPv4Field.js
it.js
json-schema.js
json-tree-inspector.js
ListField.js
MapField.js
MenuField.js
MultiAutoComplete.js
MultiSelectField.js
NumberField.js
PairField.js
PasswordField.js
RadioButton.js
RadioField.js
RTEField.js
SelectField.js
SliderField.js
StringField.js
Textarea.js
TimeField.js
TreeField.js
TypeField.js
UneditableField.js
UpperCaseField.js
UrlField.js
VectorField.js
Visus.js
Copyright (c) 2007-2009
Eric Abouaf
. All rights reserved.
Generated by
JsDoc Toolkit
2.0.0 on Wed, 04 Mar 2009 15:41:30 GMT using
neyricjslibs-template
.