This is a migrated thread and some comments may be shown as answers.

Kendo Grid Datasource with Radio buttons

1 Answer 204 Views
Grid
This is a migrated thread and some comments may be shown as answers.
crazy05
Top achievements
Rank 1
crazy05 asked on 03 Mar 2015, 01:45 PM
Here is my Kendo Datasource and code related to it. I want to display radio button list in Access Type column so that user can select Read or Read/Write or None type access. How can I pass that in my datasource ?I want radiobuttonlist at group level too.

var words = {
'count': 4,
'input': 'kendo',
'groups': [{
'field': 'Word 1',
'value': '3',
'items': [
{ 'Word': 'ACT', 'AccessType' : 'Read' },
{ 'Word': 'ADG', 'AccessType': 'Read' },
{ 'Word': 'ALF', 'AccessType': 'Read / Write' }
],
'hasSubgroups': false,
'aggregates': {}
}, {
'field': 'Word 2',
'value': '4',
'items': [
{ 'Word': 'BCB', 'AccessType': 'Read' },
{ 'Word': 'BCC', 'AccessType': 'Read / Write' },
{ 'Word': 'BCH', 'AccessType': 'None' },
{ 'Word': 'BCT', 'AccessType': 'Read' }
],
'hasSubgroups': false,
'aggregates': {}
}, {
'field': 'Word 3',
'value': '6',
'items': [
{ 'Word': 'CCC', 'AccessType': 'Read / Write' },
{ 'Word': 'CCT', 'AccessType': 'None' },
{ 'Word': 'CHH', 'AccessType': 'Read' },
{ 'Word': 'CFF', 'AccessType': 'None' },
{ 'Word': 'GCC', 'AccessType': 'Read / Write' },
{ 'Word': 'GCT', 'AccessType': 'Read' }
],
'hasSubgroups': false,
'aggregates': {}
}] 
};

var wordsDataSource = new kendo.data.DataSource({
data: words,
schema: {
groups: 'groups',
},
group: {
field: 'length'
},
serverGrouping: true,
columns: [
{ field: "Word", title: "Sites" },
{ field: "Access", title: "Access" }
]
});

$("#grid").kendoGrid({
autoBind: false,
dataSource: wordsDataSource
});

wordsDataSource.read();

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 05 Mar 2015, 09:25 AM
Hello crazy05,

This could be achieve by using a columns.template (see Templates Overview) to render the three radio buttons and assign each one a value - Read, Read/Write or None. Then check what the current item's AccessType is and add a "checked" property to the matching radio button. The same can be done in the group header templates as well. I also noticed that the columns array is specified in the DataSource, which is unsupported - it should be part of the Grid's configuration options.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
crazy05
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or