Hello,
I am having trouble trying to update a DropdownTree object from a javascript function. My goal is to do it via an Ajax call, but for testing purposes I have hardcoded the data.
This is my DDtree:
<ejs-dropdowntree id="ddtRequisitante" placeholder="Selecione um Requisitante" sortOrder="Ascending" showCheckBox="false" allowMultiSelection="false" allowFiltering="true" filterType="Contains" filterBarPlaceholder="Procurar..." select="select" change="RequisitanteValueChange" ejs-for="@Model.ViagemObj.RequisitanteId">
<e-dropdowntree-fields dataSource="@ViewData["dataRequisitante"]" value="RequisitanteId" text="Requisitante"></e-dropdowntree-fields>
</ejs-dropdowntree>
And this is the JS function:
function RenovaLista() {
RequisitanteList = [
{ RequisitanteId: "1", Requisitante: "José das Couvas" }, { RequisitanteId: "2", Requisitante: "Mauro Carvalho" }, { RequisitanteId: "3", Requisitante: "Auspício dos Santos" }
];
document.getElementById("ddtRequisitante").ej2_instances[0].dataSource= RequisitanteList;
document.getElementById("ddtRequisitante").ej2_instances[0].refresh();
}
I got no errors in the Console after running the function. But the control is not updated.
Could you help me with what I am doing wrong?
Regards,
Alexandre