I have a simple ui.combo element with the “options” attribute set to a URL (options are loaded via ajax).
I need to refresh the options from the server programmatically. Tried everything, but cannot seem to find a solution.
Thanks in advance.
I have a simple ui.combo element with the “options” attribute set to a URL (options are loaded via ajax).
I need to refresh the options from the server programmatically. Tried everything, but cannot seem to find a solution.
Thanks in advance.
var list = $$("combo").getPopup().getList();
list.clearAll();
list.load("data.php");
list is the instance of webix.ui.list
http://docs.webix.com/api__refs__ui.list.html
Thank you. As this is not obvious, can you please consider adding a “re fetch” of options to the “refresh()” method of the component or at least add a “refreshOptions()” method.
Yep, it is a commonly used functionality so a more straight API will be added in next updates.
How can I load data in combo editor of datatable on click of cell?, It fetches data but doesn’t reflect in combobox
Here is my code
locations = [{"id":"Location", "value":"Location"}];
view:"datatable",
editable:true,
header:false,
height:34,
columns:[
{ id:"id", hidden:true},
{ id:"location_name", editor:"combo",options:locations, fillspace:true },
],
data:{
id: 1,
location_name:"Location",
},
onBeforeEditStart: function(id) {
if(id.column=="location_name"){
location_editor_combo = this.getColumnConfig("location_name");
location_editor_combo.collection.load(
"<?php echo BASEURL ?>index.php/Webix/load_location_combobox_data",
{id:33847, value:'', keyword_value:4053},
function(response, data){
//What should I do here to show options in opened combobox
//as soon as it fetches data
}
);
}
}
I figured it out
Instead of using onBeforeEditStart use onAfterEditStart
Here is my code now
onAfterEditStart: function(id) {
if(id.column=="location_name" && locations.length == 1) {
this.getEditor().getPopup().getList().load("<?php echo BASEURL ?>index.php/Webix/load_location_combobox_data",{id:33847, value:'', keyword_value:4053}, function(response, data){locations = response; console.log(locations)});
}
}
Thanks