Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!

Dev Space

Customize and extend the power of Alteryx with SDKs, APIs, custom tools, and more.
SOLVED

HTML GUI SDK - Radio button default value

PetrT
Alteryx
Alteryx

Hi,

does anybody know, how to configure default option for RadioGroup/StringSelector in HTML GUI SDK V2? It was pretty easy to do in V1, but I cannot get it to work with V2. There is no such example in sample tool and didn't find anything in documentation as well.

<ayx data-ui-props='{type:"RadioGroup", widgetId:"RG1"}' ></ayx>

// Radio Group
// -----------
var stringSelector1 = new AlteryxDataItems.StringSelector('RG1', {
    optionList: [
            {label: 'XMSG("Option1")', value: "include"},
            {label: 'XMSG("Option2")', value: "exclude"},
          ]
        })
manager.addDataItem(stringSelector1)
manager.bindDataItemToWidget(stringSelector1, 'RG1') // Bind to widget

Thanks

 

Petr

2 REPLIES 2
PaulN
Alteryx Alumni (Retired)

Hi @PetrT,

 

Adding the following after your code should work:

 

window.Alteryx.Gui.Manager.getDataItem('RG1').setValue('include');

 

OR

 

window.Alteryx.Gui.Manager.getDataItem('RG1').setValue('exclude');

 

Thanks,

 

Paul Noirel

Sr Customer Support Engineer, Alteryx

 

PetrT
Alteryx
Alteryx
Thanks a lot @PaulN, works fine.