AutoComplete Unique Items

Aug 26, 2011 at 4:12 PM

Hi, I am using the SPService to GetListItems to provide an 'autocomplete' function on one of the columns within a list, the problem being is that the details in this column are not unique; is there a way to return only unique items to the autocomlpete function.

Code Snippet:

var domElementArray = $('[nodeName="z:row"]', xData.responseXML); 
var dataMap = domElementArray.map(function(){ 
	var v; 
	if($(this).hasAttr('ows_IMEINumber')) {
	 v = $(this).attr('ows_IMEINumber').split(";#").pop(); 
	} 
	return{ value: v }; 
}); 
var data = dataMap.get(); 
Not too sure where and how to look for / remove non-unique items in the data.
Jules
Coordinator
Aug 26, 2011 at 6:19 PM

Jules:

Assuming your items are sorted by the column. you can simply add logic in your .each() to compare each value to the last value. If it's new, then use it, else not.

M.