tags:

views:

17

answers:

1

The question is probably better answered by how do I get value == displayedValue. Or how do I prevent value to be Index based and instead use the textstring I provide from my store.

My Json has this structure:

{"items":[{"zipcity":"Stocka"},{"zipcity":"Stockamöllan"},{"zipcity":"Stockaryd"}]}

Does it need to change?

Currently This is my filteringselect code:

postadressStore = new dojox.data.QueryReadStore({url: "LKP.json"}); postadressStore.fetch({serverQuery:{name:''}, queryOptions:{ignoreCase:true}});

    new dijit.form.FilteringSelect({
        store: postadressStore,
        hasDownArrow: false,
        autoComplete: false,
        searchAttr: "zipcity",
        style: "width: 290px;",
        name:"postadress",
        id: "postadress_id",
        validate: function() { return true;}
        },"postadress");

I tried this for changing the value but value is read-only?

var elm = dijit.byId("postadress_id"); var val = elm.attr('displayedValue'); elm.attr('value',val);

A: 

postadressStore.getIdentity = function(item) { return item.i.zipcity;
}

is the required addition. this makes the store set identity equal to the value of each post.

also fetch is really unneccesary. postadressStore.fetch({serverQuery:{name:''}, queryOptions:{ignoreCase:true}}); can be removed

So the complete init of the store should be:

var postadressStore = new dojox.data.QueryReadStore({url: "LKP.json"}); postadressStore.getIdentity = function(item) { return item.i.zipcity;
}

Kalle