Wednesday 15 January 2014

dojo - How to populdate the dijit.form.ComboBox by calling the URL which will returns JSON data? -



dojo - How to populdate the dijit.form.ComboBox by calling the URL which will returns JSON data? -

i have combox box component in dojo datagrid like

var tacstore = {items:[]}; tac

and have button when clicked button trying populate 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); } }); homecoming 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}}); } homecoming false; }

am getting response. values not showing in combobox. , when click on combo box getting error this.fetch not function

first, using itemfilewritestore, old dojo/data/api api. combo box uses newer dojo/store/api api (specifically, can utilize dojo/store/memory implementation).

var mystore = new memory({data: timezone});

also, creating store, not connecting combobox. if programatically creating combobox, use

var mycombobox = new combobox({store: mystore}); mycombobox.placeat(/* wherever */); mycombobox.startup();

if combobox created (either programatically, or using markup data-dojo-id), use

mycombobox.set('store', mystore); /* may need startup combobox after - not sure */ mycombobox.startup();

combobox dojo dojox.grid.datagrid

No comments:

Post a Comment