Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Nguyen
committed
Apr 3, 2012
1 parent
c838a99
commit e316b40
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
Ext.ux.SliderWithBars | ||
=== | ||
|
||
### Introduction | ||
|
||
This is a Sencha Touch 2 component, extending Ext.slider.Slider with the **abilility to put progress bars inside**. | ||
|
||
**[Demo](http://stnguyen.com/demo/sencha-touch/Ext.ux.SliderWithBars/)** | ||
|
||
### How to use | ||
|
||
1. Copy `slider_with_bars` folder into your project root folder. | ||
2. Include files: | ||
|
||
<link rel="stylesheet" href="slider_with_bars/style.css" type="text/css"> | ||
|
||
<script type="text/javascript" src="slider_with_bars/bar.js"></script> | ||
<script type="text/javascript" src="slider_with_bars/slider.js"></script> | ||
|
||
4. Usage | ||
|
||
{ | ||
xtype: "slider-with-bars", | ||
value: 15, | ||
barValue: [70, 15], | ||
id: 'mySlider', | ||
barCls: ['', 'x-bar-orange'] | ||
}, | ||
### API | ||
|
||
|
||
This component extends `Ext.slider.Slider`, so [all functions provided by its parent class](http://docs.sencha.com/touch/2-0/#!/api/Ext.slider.Slider) are inherited unchanged. | ||
|
||
|
||
##### Set the number of bars and their values | ||
|
||
The number of bars is derived from the length of `barValues` array being passed in, so this line will create 3 bars: | ||
|
||
mySlider.setBarValue([70, 30, 10]); | ||
|
||
** Note **: because later bar (in the array above) will overlay the previous ones, so the bar with bigger value should be put on top. | ||
|
||
##### Set css classes for each bar | ||
|
||
You can customize each bars' style by applying css classes to them. | ||
|
||
mySlider.setBarCls(['', 'x-bar-orange', 'x-bar-green']); | ||
|
||
The number of css classes in the array should be equal to the number of bars created. |