0

Iam using DevExtreme 14.2 version, am not able to set default value on dxRadioGroup. consider the following code i don't know where i did mistake.

HTML:

      <div data-bind="dxRadioGroup: { dataSource: items, layout: 'horizontal', value: defaultvalue, valueExpr: 'this' }"></div>

JS:

 dxSample_13_2.home = function (params) {

  var viewModel = {
    items: [
        { text: "Tea" },
        { text: "Coffee" },
        { text: "juice" }
    ],
    defaultvalue: ko.observable(items[2]),
  }

  return viewModel; 
 };
sona
  • 123
  • 3
  • 13

1 Answers1

0

Looks like you have an error in your code. There is no items variable that you try to access.

var items = [
        { text: "Tea" },
        { text: "Coffee" },
        { text: "juice" }
    ];

var viewModel = {
    items: items,
    defaultvalue: ko.observable(items[2])
};

See working fiddle: http://jsfiddle.net/tabalinas/tfvtq9y0/

tabalin
  • 2,303
  • 1
  • 15
  • 27