- How can I put two buttons in one raw? Start and Stop buttons
- How can auto refresh status can be displayed as text? for eg if uci config value is 0 show "Service is down" and if 1 show "Service is active"?
Yes. I need to show running state (with refreshing its state) and buttons to stop and start service
like in PBR
why not give them an id and target them with CSS ??
ie
< button id="myButton ...
and in css
#myButton
{
<my styles> ...
}
or give them a class ... or both if individual styling is needed
the answer/s to the second part of your question can be found here ...
and the status
1 Like
Ended up with this
var service_control = form.DummyValue.extend({
renderWidget: function(section_id, option_id, cfgvalue) {
return E([], [ E('div', { 'style': 'padding-top: 14px', 'class': 'control-group' }, [
E('button', {
'class': 'cbi-button cbi-button-apply',
'click': ui.createHandlerFn(this, function() {
ui.addNotification(null, [ E('p', [ 'Service started' ]) ]);
}),
}, _('Start')),
E('button', {
'style': 'margin-left: 8px',
'class': 'cbi-button cbi-button-reset',
'click': ui.createHandlerFn(this, function() {
ui.addNotification(null, [ E('p', [ 'Service stoped' ]) ]);
}),
}, _('Stop'))
])]);
},
});
o = s.option(service_control, 'settings', _(''));