I have a combox box component in the dojo datagrid like
var tacStore = {items:[]}; Tac
And i have button when i clicked the button am trying to populate the Combo box using below code.
function loadTimeZones() {
dojo.xhrGet({
//url: "/AAORPCAdapterServicesWeb/RPCAdapter/httprpc/TimeZoneService/getTimeZones",
url: "/AAORPCAdapterServicesWeb/RPCAdapter/httprpc/DeliverableService/getAllTacs",
handleAs:"json",
load: createTimeZoneStore,
error: function(error,ioargs){
console.log(error);
}
});
return false;
}
function createTimeZoneStore(response) {
console.log("createTimeZoneStore::response:: "+response);
if ( response.result != null) {
var timezone = [];
for(var resultCounter=0; resultCounter<response.result.length;resultCounter++)
{
timezone[resultCounter] = {};
timezone[resultCounter]['name']=response.result[resultCounter];
console.log("createTimeZoneStore::response.result[resultCounter]:: "+response.result[resultCounter]);
}
console.log("createTimeZoneStore::tacStore::tacs: "+tacStore);
tacstore= new dojo.data.ItemFileWriteStore({data:{items:timezone}});
}
return false;
}
Am getting response. But the values are not showing in the combobox. And when i click on combo box am getting error like this.fetch is not a function
First, you are using ItemFileWriteStore, which is the old
dojo/data/api
API. Combo box uses the newerdojo/store/api
API (specifically, you can use thedojo/store/Memory
implementation).Also, you are creating the store, but not connecting it to the ComboBox. If you are programatically creating the ComboBox, use
If the ComboBox is already created (either programatically, or using markup with
data-dojo-id
), use