4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-slider-Tip'>/**
19 </span> * @class Ext.slider.Tip
20 * @extends Ext.tip.Tip
21 * Simple plugin for using an Ext.tip.Tip with a slider to show the slider value. In general this
22 * class is not created directly, instead pass the {@link Ext.slider.Multi#useTips} and
23 * {@link Ext.slider.Multi#tipText} configuration options to the slider directly.
24 * {@img Ext.slider.Tip/Ext.slider.Tip1.png Ext.slider.Tip component}
27 Ext.create('Ext.slider.Single', {
32 renderTo: Ext.getBody()
35 * Optionally provide your own tip text by passing tipText:
37 new Ext.slider.Single({
42 tipText: function(thumb){
43 return Ext.String.format('<b>{0}% complete</b>', thumb.value);
49 Ext.define('Ext.slider.Tip', {
50 extend: 'Ext.tip.Tip',
52 alias: 'widget.slidertip',
57 init: function(slider) {
62 dragstart: me.onSlide,
68 <span id='Ext-slider-Tip-method-onSlide'> /**
70 * Called whenever a dragstart or drag event is received on the associated Thumb.
71 * Aligns the Tip with the Thumb's new position.
72 * @param {Ext.slider.MultiSlider} slider The slider
73 * @param {Ext.EventObject} e The Event object
74 * @param {Ext.slider.Thumb} thumb The thumb that the Tip is attached to
76 onSlide : function(slider, e, thumb) {
79 me.update(me.getText(thumb));
80 me.doComponentLayout();
81 me.el.alignTo(thumb.el, 'b-t?', me.offsets);
84 <span id='Ext-slider-Tip-method-getText'> /**
85 </span> * Used to create the text that appears in the Tip's body. By default this just returns
86 * the value of the Slider Thumb that the Tip is attached to. Override to customize.
87 * @param {Ext.slider.Thumb} thumb The Thumb that the Tip is attached to
88 * @return {String} The text to display in the tip
90 getText : function(thumb) {
91 return String(thumb.value);