Edit this page

ButtonGroup PHP Class Overview

The Kendo UI ButtonGroup for PHP is a server-side wrapper for the Kendo UI ButtonGroup widget.

Getting Started

Make sure you are familiar with some of the fundamental Kendo UI widget concepts and that the Kendo UI PHP wrappers are setup correctly.

The Basics

The ButtonGroup widget groups a series of buttons together on a single line.

Initialization

The example below demonstrates how to initialize the ButtonGroup by using the default buttongroup tag.

Example
$buttonGroup = new \Kendo\UI\ButtonGroup('select-period');
$month = new \Kendo\UI\ButtonGroupItem();
$month->text("Month");
$quarter = new \Kendo\UI\ButtonGroupItem();
$quarter->text("Quarter");
$year = new \Kendo\UI\ButtonGroupItem();
$year->text("Year");

$buttonGroup->addItem($month, $quarter, $year);

echo $buttonGroup->render();

Features

Enable and Disable ButtonGroup

You can configure the ButtonGroup to be initially disabled by using its enable property. The ButtonGroup can also be disabled or enabled at any time with JavaScript by using the enable() method with a Boolean argument. For more information on the enable method of the ButtonGroup, refer to the ButtonGroup API.

The following example demonstrates how to enable and disable the ButtonGroup.

Example
$disabledButtonGroup = new \Kendo\UI\ButtonGroup('disabledButton');
$disabledButtonGroup->attr('type', 'buttongroup')
           ->enable(false)
           ->content('Disabled buttongroup');

echo $disabledButtonGroup->render();

Index

The initially selected index of the ButtonGroup can be configured by using its index property. An index can also be selected over the select() method with an Integer argument. For more information on the select method of the ButtonGroup, refer to the ButtonGroup API.

The following example demonstrates how to select a button by its index.

$buttonGroup = new \Kendo\UI\ButtonGroup('select-period');
$month = new \Kendo\UI\ButtonGroupItem();
$month->text("Month");
$quarter = new \Kendo\UI\ButtonGroupItem();
$quarter->text("Quarter");
$year = new \Kendo\UI\ButtonGroupItem();
$year->text("Year");

$buttonGroup->addItem($month, $quarter, $year);
$buttonGroup->select(0);

echo $buttonGroup->render();

Reference

Existing Instances

To reference an existing ButtonGroup instance, refer to the introductory article on the ButtonGroup.

See Also

Other articles on Telerik UI for PHP and on the ButtonGroup:

Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy