PDA

View Full Version : Retrieving duplicate value from Json file into ComboBox



Sneha004
29 Feb 2012, 3:40 AM
Hi,

I am trying to remove duplicate value from ComboBox which is loading the data from Json file for a particular column.

Unfortunately I am unable to solve this one.

Can anyone give me the solution for this ?

Thanks in advance.....................

vietits
29 Feb 2012, 4:37 AM
var hash = {};
var value;
store.each(function(record){
value = record.get('field');
if(hash[value]) store.remove(record);
hash[value] = true;
})

Sneha004
29 Feb 2012, 11:42 PM
Thanks vietits,,

I got your statements.
I was trying to implement this code in button handler because when I click on the button the value will be populated into the combo box but not the duplicate value.
But it was showing duplicate values

Can you give some hint that where I should implement the code ?

Thanks.............

vietits
1 Mar 2012, 12:15 AM
@Sneha004,

I am not sure to clearly understand your request. Do you mean the data you load to combobox is not duplicated but it shows the duplicated values? If so, try to remove the old data from the combobox before loading the new one.