Class \Prado\Web\UI\WebControls\TSlider
TSlider displays a slider for numeric input purpose. A slider consists of a 'track', which define the range of possible value, and a 'handle' which can slide on the track, to select a value in the range. The track can be either Horizontal or Vertical, depending of the \Prado\Web\UI\WebControls\SetDirection property. By default, it's horizontal.
The range boundaries are defined by \Prado\Web\UI\WebControls\SetMinValue and \Prado\Web\UI\WebControls\SetMaxValue properties. The default range is from 0 to 100. The \Prado\Web\UI\WebControls\SetStepSize property can be used to define the step between 2 values inside the range. Notice that this step will be recomputed if there is more than 200 values between the range boundaries. You can also provide the allowed values by setting the \Prado\Web\UI\WebControls\SetValues array.
A 'Progress Indicator' can be displayed within the track with the \Prado\Web\UI\WebControls\SetProgressIndicator property.
The TSlider control can be easily customized using CssClasses. You can provide your own css file, using the \Prado\Web\UI\WebControls\SetCssUrl property. The css class for TSlider can be set by the \Prado\Web\UI\WebControls\setCssClass property. Default value is "Slider HorizontalSlider" for an horizontal slider, and "Slider VerticalSlider" for a vertical one.
If \Prado\Web\UI\WebControls\SetAutoPostBack property is true, postback is sent as soon as the value changed.
TSlider raises the onValueChanged event when the value of the slider has changed during postback.
You can also attach ClientSide javascript events handler to the slider :
- ClientSide.onSlide is called when the handle is slided on the track. You can get the current value in the value javascript variable. You can use this event to update on client side a label with the current value
- ClientSide.onChange is called when the slider value has changed (at the end of a move).
Class hierarchy
- \Prado\Web\UI\WebControls\TSlider implements IPostBackDataHandler, IDataRenderer
- \Prado\Web\UI\WebControls\TWebControl implements IStyleable
- \Prado\Web\UI\TControl implements IRenderable, IBindable
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.1.1
public
|
|
public
|
getClientSide() : TSliderClientScript
Gets the TSliderClientScript to set the TSlider event handlers.
The slider on the client-side supports the following events. OnSliderMove -- raised when the slider is moved.OnSliderChanged -- raised when the slider value is changedYou can attach custom javascript code to each of these events |
public
|
|
public
|
getData() : float
Returns the value of the TSlider control.
This method is required by IDataRenderer. It is the same as getValue(). |
public
|
getDataChanged() : bool
Returns a value indicating whether postback has caused the control data change.
This method is required by the \Prado\Web\UI\IPostBackDataHandler interface. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
loadPostData(string $key, array<string|int, mixed> $values) : bool
Loads user input data.
This method is primarly used by framework developers. |
public
|
onPreRender(mixed $param) : mixed
Registers CSS and JS.
This method is invoked right before the control rendering, if the control is visible. |
public
|
onValueChanged(TEventParameter $param) : mixed
Raises <b>OnValueChanged</b> event.
This method is invoked when the \Prado\Web\UI\WebControls\getValue property changes on postback. If you override this method, be sure to call the parent implementation to ensure the invocation of the attached event handlers. |
public
|
raisePostDataChangedEvent() : mixed
Raises postdata changed event.
This method is required by IPostBackDataHandler interface. It is invoked by the framework when \Prado\Web\UI\WebControls\getValue property is changed on postback. This method is primarly used by framework developers. |
public
|
|
public
|
setAutoPostBack(bool $value) : mixed
Sets the value indicating if postback automatically.
An automatic postback to the server will occur whenever the user modifies the slider value. |
public
|
|
public
|
setData(string $value) : mixed
Sets the value of the TSlider control.
This method is required by IDataRenderer. It is the same as setValue(). |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
setStepSize(float $value) : mixed
Sets the step size used to determine the places where the slider handle can stop at.
An evenly distributed stop marks will be generated according to \Prado\Web\UI\WebControls\getMinValue, \Prado\Web\UI\WebControls\getMaxValue and StepSize. To use uneven stop marks, set \Prado\Web\UI\WebControls\setValues. |
public
|
|
public
|
setValues(array<string|int, mixed> $value) : mixed
Sets the possible values that the slider can take.
If this is set, \Prado\Web\UI\WebControls\setStepSize will be ignored. The latter generates a set of evenly distributed candidate values. |
protected
|
|
protected
|
|
protected
|
getClientClassName() : string
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation. |
protected
|
|
protected
|
|
protected
|
registerStyleSheet() : mixed
Registers the CSS relevant to the TSlider.
It will register the CSS file specified by \Prado\Web\UI\WebControls\getCssUrl. If that is not set, it will use the default CSS. |
public
mixed
|
MAX_STEPS
|
200
|