Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14348 closed defect (invalid)

Set ComboBox.store programmatically fails

Reported by: maceto Owned by: Douglas Hays
Priority: high Milestone:
Component: Dijit - Form Version: 1.7.0
Keywords: set ComboBox.store programmatically Cc:
Blocked By: Blocking:

Description

HTML

<input dojoType="dijit.form.ComboBox?" name="state" id="state" autoComplete="true" required="true" onchange="LoadCities?"</input>

Code

function LoadCities?(newValue) {

checkLoadAddrDijits(); jsonDSUF1.fetch({

queryOptions: {ignoreCase: true}, query: {name: newValue}, onItem: function (item, request) {

LoadJSON_DS_City(item.uf);

fCity.store = jsonDSCity; fCity.searchAttr = "name";

}

});

}

Where jsonDSCity is a dojo.data.ItemFileReadStore? type.

OBS

This code works perfectly in version 1.6.0 and 1.6.1!

Change History (5)

comment:1 Changed 7 years ago by maceto

HTML

<input dojoType="dijit.form.ComboBox?" name="state" id="state" autoComplete="true" required="true" onchange="LoadCities?"</input>

<input dojoType="dijit.form.ComboBox?" name="city" id="city" autoComplete="true" required="true"</input></td>

Code

function checkLoadAddrDijits() {

if (fState == undefined) {

fState = dijit.byId('state');

fCity = dijit.byId('city');

}

}

function LoadCities?(newValue) {

checkLoadAddrDijits();

jsonDSUF1.fetch({

queryOptions: {ignoreCase: true}, query: {name: newValue},

onItem: function (item, request) {

LoadJSON_DS_City(item.uf);

fCity.store = jsonDSCity;

fCity.searchAttr = "name";

}

});

}

Where jsonDSCity is a dojo.data.ItemFileReadStore? type.

OBS

This code works perfectly in version 1.6.0 and 1.6.1!

comment:2 Changed 7 years ago by ben hockey

Priority: highnormal
severity: criticalnormal

did you try fCity.set('store', jsonDSCity); like you should be doing when setting widget properties? same for searchAttr. setting the property directly works in some cases but if you want your code to stay compatible with future versions, use set and get.

btw, this is not to say that using set will definitely work for you but this isn't a bug unless using set doesn't work.

comment:3 Changed 7 years ago by bill

Resolution: invalid
Status: newclosed

Presumably it's what neonstalwart said. In the future please attach test cases using the "attach file" button rather than inlining code snippets into the ticket. And also, read the release notes, as this kind of thing is documented.

comment:4 in reply to:  2 Changed 7 years ago by maceto

Replying to neonstalwart:

did you try fCity.set('store', jsonDSCity); like you should be doing when setting widget properties? same for searchAttr. setting the property directly works in some cases but if you want your code to stay compatible with future versions, use set and get.

btw, this is not to say that using set will definitely work for you but this isn't a bug unless using set doesn't work.

Thanks,

I made the changes you suggested. It worked perfectly.

comment:5 in reply to:  3 Changed 7 years ago by maceto

Replying to bill:

Presumably it's what neonstalwart said. In the future please attach test cases using the "attach file" button rather than inlining code snippets into the ticket. And also, read the release notes, as this kind of thing is documented.

Ok, Thanks.

Note: See TracTickets for help on using tickets.