3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
15 <div id="cls-Ext.slider.Tip"></div>/**
16 * @class Ext.slider.Tip
18 * Simple plugin for using an Ext.Tip with a slider to show the slider value. Example usage:
24 plugins: new Ext.slider.Tip()
27 * Optionally provide your own tip text by overriding getText:
33 plugins: new Ext.slider.Tip({
34 getText: function(thumb){
35 return String.format('<b>{0}% complete</b>', thumb.value);
41 Ext.slider.Tip = Ext.extend(Ext.Tip, {
45 init: function(slider) {
48 dragstart: this.onSlide,
51 destroy : this.destroy
57 * Called whenever a dragstart or drag event is received on the associated Thumb.
58 * Aligns the Tip with the Thumb's new position.
59 * @param {Ext.slider.MultiSlider} slider The slider
60 * @param {Ext.EventObject} e The Event object
61 * @param {Ext.slider.Thumb} thumb The thumb that the Tip is attached to
63 onSlide : function(slider, e, thumb) {
65 this.body.update(this.getText(thumb));
67 this.el.alignTo(thumb.el, 'b-t?', this.offsets);
70 <div id="method-Ext.slider.Tip-getText"></div>/**
71 * Used to create the text that appears in the Tip's body. By default this just returns
72 * the value of the Slider Thumb that the Tip is attached to. Override to customize.
73 * @param {Ext.slider.Thumb} thumb The Thumb that the Tip is attached to
74 * @return {String} The text to display in the tip
76 getText : function(thumb) {
77 return String(thumb.value);
81 //backwards compatibility - SliderTip used to be a ux before 3.2
82 Ext.ux.SliderTip = Ext.slider.Tip;</pre>