0
我想刪除此商店中的重複值。如何刪除商店中的重複值extjs
有時候,url會返回一些重複的值,我該如何刪除重複值並且只是列出該值1次?
var input1store = new Ext.data.Store({
fields: [{name: 'name'}],
proxy:{
type: 'ajax',
url: 'www.requesturl.com?format=json&source1',
reader: {
type: 'json',
root: 'xml.result'
}
},
autoLoad:false,
sorters: [{property: 'name', direction: 'asc'}]
});
代碼,我有你的建議,但仍然無法正常工作。 Input1store2應該只包含唯一值。
var input1storeArray = [];
var input1store = new Ext.data.Store({
fields: [{name: 'name'}],
proxy:{
type: 'ajax',
url: 'www.requesturl.com?format=json&source1',
reader: {
type: 'json',
root: 'xml.result'
}
},
autoLoad:false,
sorters: [{property: 'name', direction: 'asc'}],
listeners: {
load: function(store){
input1storeArray = Ext.Array.unique(store.getRange());
}
}
});
var input1store2 = new Ext.data.SimpleStore({
field = ['name'],
data = input1storeArray
});
我試圖根據你在這裏的建議來做。但我未能使其工作。這有可能是你給我一個例子或一個快速的代碼。 THanks – shiro
你可以發佈你的代碼,我會盡力幫你找到一個錯誤? – sha
我已經更新了上面的問題,包括代碼來收集獨特的價值,但它似乎並沒有工作。 – shiro