\Kendo\UI\Rating

A PHP wrapper for Kendo UI Rating.

Inherits from \Kendo\UI\Widget.

Usage

To use Rating in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo Rating

<?php
// Create a new instance of Rating and specify its id
$rating = new \Kendo\UI\Rating('Rating');

// Configure it
$rating->enabled(true)

// Output it

echo $rating->render();
?>

Methods

change

Fires when the value of the Rating is changed through user interaction. For additional information check the change event documentation.

Returns

\Kendo\UI\Rating

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

enabled

If set to false, the Rating will be: disabled and will not allow the user to change its state.; excluded from the tab order and not receiving focus. or will not submit its value if part of a form..

Returns

\Kendo\UI\Rating

Parameters

$value boolean

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->enabled(true);
?>

hoveredTemplate

Specifies the template which is used for rendering the hovered state of the items.

Returns

\Kendo\UI\Rating

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->hoveredTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->hoveredTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

itemTemplate

Specifies the template which is used for rendering the items of the Rating.

Returns

\Kendo\UI\Rating

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->itemTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->itemTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

label

The Rating displays a label by default that shows the current value out of the max value 3 / 5. If the widget does not have a selected value, the label will not be displayed initially and will be toggled after an item is selected.If label is set to false, the widget will not display the label.

Returns

\Kendo\UI\Rating

Parameters

$value boolean|\Kendo\UI\RatingLabel|array

Example - using boolean

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->label(true);
?>

Example - using \Kendo\UI\RatingLabel

<?php
$rating = new \Kendo\UI\Rating('Rating');
$label = new \Kendo\UI\RatingLabel();
$template = 'value';
$label->template($template);
$rating->label($label);
?>

Example - using array

<?php
$rating = new \Kendo\UI\Rating('Rating');
$template = 'value';
$rating->label(array('template' => $template));
?>

max

The value to which the Rating items will be rendered.

Returns

\Kendo\UI\Rating

Parameters

$value float

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->max(1);
?>

min

The value from which the Rating items will be rendered.

Returns

\Kendo\UI\Rating

Parameters

$value float

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->min(1);
?>

precision

Specifies the precision with which an item is selected. The available options are:*item - rate by selecting the whole item. *half - rate by selecting half of the item or the whole item.

Returns

\Kendo\UI\Rating

Parameters

$value string

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->precision('value');
?>

readonly

If set to true, the Rating will: be in readonly state and will not allow the user to change its state.; be included in the tab order and able to receive focus. or submit data if part of a form..

Returns

\Kendo\UI\Rating

Parameters

$value boolean

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->readonly(true);
?>

select

Fires when an item is selected through user interaction. For additional information check the select event documentation.

Returns

\Kendo\UI\Rating

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->select('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onSelect(e) {
        // handle the select event.
    }
</script>
<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->select('onSelect');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->select(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

selectValueOnFocus

If the option is set, the widget will automatically select the specified item when the Rating receives focus and no previous value has been set.

Returns

\Kendo\UI\Rating

Parameters

$value float

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->selectValueOnFocus(1);
?>

selectedTemplate

Specifies the template which is used for rendering the selected state of the items.

Returns

\Kendo\UI\Rating

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->selectedTemplate('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->selectedTemplate(new \Kendo\JavaScriptFunction('function() { }'));
?>

selection

Specifies the selection behavior. The available options are:*continuous - all items, starting from the first one, are marked as selected. *single - a single item is marked as selected.

Returns

\Kendo\UI\Rating

Parameters

$value string

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->selection('value');
?>

tooltip

The Rating displays the value of the item through the title attribute when it is hovered.If tooltip is set to false, the widget will not display the value of the items when hovering over them.The tooltips are not visible when the Rating is disabled.

Returns

\Kendo\UI\Rating

Parameters

$value boolean

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->tooltip(true);
?>

value

Specifies the initial value of the Rating.If a greater value than the max option is used, then the max value will be set.If a value less than the min option is used, then the min value will be set.

Returns

\Kendo\UI\Rating

Parameters

$value float

Example

<?php
$rating = new \Kendo\UI\Rating('Rating');
$rating->value(1);
?>
In this article
Not finding the help you need?