DataSource in JQuery GroupButton widget

19 Apr 20174 minutes to read

GroupButton can populate the button items based on data source and by specifying the associated fields.

Refer the below table to know about the available fields


Text to be displayed in button


Icon class name – prefixIcon will be displayed from the left margin of the button.


Icon class name – suffixIcon will be displayed from the left margin of the button.


Specifies content type of button item


Specifies position of the image in a button item


Specifies the selection state of button item


Used to include the URL tag to the button item


It defines the HTML attributes such as class and styles for an button item.


It defines the image attributes such as height, width, styles, etc.

Local Data

To set the local JSON data, define a JSON array and initialize the GroupButton with dataSource property. Specify the column names in the fields’ property.


the columns are bounded automatically when the fields are specified with the default names like id, text, etc…

Below is the sample to code to render the GroupButton JSON dataSource,

  • HTML
  • <div id="groupButton">
  • JS
  • <script>
                    groupButtonMode: "radiobutton",
                    dataSource: [
                    { text: "Day", contentType: "textonly" },
                    { text: "Week", contentType: "textonly" },
                    { text: "Work Week", contentType: "textonly" },
                    { text: "Month", contentType: "textonly", selected: "selected" },
                    { text: "Agenda", contentType: "textonly" }],
                    showRoundedCorner: true


    Remote Data

    To bind remote data to the GroupButton, you can assign a service data as an instance of ejDataManager to the dataSource property along with the fields mapping.

  • JS
  • <script>
                var dataManger = ej.DataManager({
                    url: ""
                // Query creation
                var query = ej.Query().from("Orders").take(6);
                $(function () {
                    //  declaration 
                        dataSource: dataManger,
                        fields: { text: "CustomerID" },
                        query: query,