-3

How do I get all the values of a particular field from a store?

I have a grid and i want to fetch all the values of a particular column without clicking any cell, is it possible?

Can i fetch all the values directly from the store for a particular field?

var someStore = new dojo.data.ItemFileWriteStore({data : result});
dijit.byId('gridId').setStore(someStore);
dijit.byId('gridId').startup();

I tried fetch and dojox.json.query, both doesnt work.

4

2 回答 2

0

Try this:

         store.fetch({
            onItem: function (item) {
                console.log(store.getValue(item, 'USERNAME'));
                console.log('PASSWORD: ', store.getValue(item, 'PASSWORD'));
                console.log('DESC: ', store.getValue(item, 'DESC'));
            }
        });
于 2013-08-23T12:59:42.180 回答
0

Assuming your column name is "somefield", you can try this :

store.fetch({
    onComplete : function(items, request){
        var colValues = dojo.map(items, function(item){
            return store.getValue(item, "somefield");
        });
    }
}
于 2013-08-23T20:15:05.133 回答