Latest value chosen in choice dialog!
miladhashemi opened this issue · comments
SeyedMilad Hashemi commented
Hi,
Continued widget development(os-js/osjs-widgets#9), i faced new problem.
I kept a paramter as widget custom options.
measurment: 'netdata.apps.cpu.X'
Due to changing this custom option value I used choice dialog, but I don't know how should I use my parameter value as choice dialog default value.
createMeasurmentDialog() {
this.core.make('osjs/dialog', 'choice', {
title: 'Measurment',
message: 'Select Measurment',
//TODO: make this list via grafana service
choices: {
'netdata.apps.cpu.X': 'netdata.apps.cpu.X',
'netdata.statsd_timer_swift.object_server.put.timing.events': 'netdata.statsd_timer_swift.object_server.put.timing.events'
},
}, (btn, value) => {
if (btn === 'ok') {
this.options.measurment = value;
this.render();
this.saveSettings();
}
});
}
Anders Evenrud commented
So, you want to be able to define the default value in the dropdown based on that option from your widget ?
SeyedMilad Hashemi commented
Exactly
Anders Evenrud commented
If you update your @osjs/dialogs
(version 3.0.20) you should now have a value: something
option for the dialog to override the default value.