Boa noite! Preciso preencher automaticamente o campo de gestor, que está no mesmo dataset do prefixo selecionado no campo select.
html
<div class="form-group col-md-3">
<label for="pref">CENTRO DE CUSTO</label>
<select onchange="onChangeCombo(this)" class="filtro form-control"
id="pref" name="pref" dataset="dsAprov" datasetkey="Prefixo"
datasetvalue="Prefixo" addBlankLine="true"></select>
</div>
<div class="form-group col-md-2">
<label for="g2">GESTOR</label>
<input type="text" class="form-control" id="g1" name="g1">
</div>
js
function onChangeCombo(combo){
var prefixo = combo.value;
var c1 = DatasetFactory.createConstraint("Prefixo", prefixo, prefixo, ConstraintType.MUST);
var constraints - new Array(c1);
var returnFields - new Array("gestorprincipal");
var gestor = DatasetFactory.getDataset("dsAprov", returnFields, constraints, null);
var index = combo.id.substring(combo.id.indexOf('___') + 3);
var selecionagestor = gestor.values[0]["gestorprincipal"];
$('#g1').val(selecionagestor)
}
dataset
dataset.addColumn("Prefixo");
dataset.addColumn("gestorprincipal");