We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Property 'enableDistinct' and 'select event' in ejAutocomplete with web api adaptor and mutiSelectionMode

Thread ID:

Created:

Updated:

Platform:

Replies:

129054 Feb 23,2017 09:01 AM Mar 2,2017 07:51 AM JavaScript 5
loading
Tags: ejAutoCompleteTextBox
Jason Zhu
Asked On February 23, 2017 09:01 AM

Hi,

ejAutocomplete allows to select more than one option in mutiSelectionMode.  By default, it can select same option multiple times. We want to avoid such duplication.

I have tried member 'EnableDistinct'.  It does not take effect.   According to document, it seems 'select' event can suit my requirement.    If selected item has been selected before,  we can set  'cancel' as true to cancel this select event. However, it does not work as anticipated.

Could you please  give example to illustrate  how to use 'EnableDistinct'  and 'select event' in aforementioned scenario?


Thanks,
Jim 




Arun Palaniyandi [Syncfusion]
Replied On February 24, 2017 02:31 AM

Hi Jim,   
   
Thanks for contacting Syncfusion Support.     
   
The enableDistinct property is only used to remove the duplicate names present in the search result, and it will not affect the selected value. To achieve your scenario, use the select event as you have tried and use this event to filter the value and then set the value to the input textbox.   
   
Please find below the playground demo link for your reference.   
   
This type of problem will not occur in the multiSelectMode as VisualMode. In this mode, once the value is selected, it will not come again in the suggestion list and hence there are no duplicate values to be selected.   
   
   
If the provided sample does not meet your requirement, please give us with more information that will help us to provide the solution.    
   
Regards,   
Arun P.   


Jason Zhu
Replied On February 28, 2017 03:11 PM

 Arun P,

Thanks for help.  

For the first link http://jsplayground.syncfusion.com/qjef4fga   , it  has bug if I  change  mode as : ej.MultiSelectMode.VisualMode.
In text box, type 'a', select first item 'Alabama' and type character 'a' immediately, it will show 'Alabama,a'  following 'Alabama' option  in text box .

And  'enableDistinct' only works for local  data source, in enterprise application, we usually refers to remote data source.

In online document https://help.syncfusion.com/api/js/ejautocomplete#events:select,   it  mentions:   Set this option to true to cancel the event. However, I set option as true, 'select' event  is not cancelled, it just continues remaining process. Otherwise,  'cancel' would be  nice solution to avoid duplicated item.


Jim 




Arun Palaniyandi [Syncfusion]
Replied On March 1, 2017 06:10 AM

Hi Jim,   
   
Thanks for your update.   
    
Query1:” it has bug if I change mode as : ej.MultiSelectMode.VisualMode”   
 As told earlier, in Visual Mode once the value is selected, it will not come again in the suggestion list and hence there are no duplicate values to be selected. It is not an issue. So, please use the previous shared workaround sample for the Delimiter mode, as suggested.   
    
Query2:” And 'enableDistinct' only works for local  data source, in enterprise application, we usually refers to remote data source.”   
 We have tried to reproduce this issue, but we were unable to reproduce it. The enableDistinct property is working fine and duplication is also avoided in remote datasource.   
   
 Query3:” 'cancel' would be nice solution to avoid duplicated item”   
 The behavior of the “cancel” argument in select event is not what you expect. This cancel argument is used to cancel the remaining operations after the event triggered in our source. Therefore, it is not the correct scenario to use the “cancel” argument for cancelling the select event itself.    
   
Please let us know if you have any further queries.   
   
Regards,   
Arun P.   


Jason Zhu
Replied On March 1, 2017 09:02 AM

How to reproduce bug mentioned in preceding query 1?
1)In  http://jsplayground.syncfusion.com/qjef4fga , Change  multiSelectionMode as VisualMode.
2)Run script
3)Type 'a' in text box,  use mouse to select 'Arizona' 
4)Type any character again, for example 'a', it will immediately show 'Arizona a' in text box. It is supposed to only show  what you entered (here it is 'a').   That is bug.



Thanks,
Jim




Arun Palaniyandi [Syncfusion]
Replied On March 2, 2017 07:51 AM

Hi Jim,    
    
A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates. 
 
Please let us know if you have any queries. 
 
Regards, 
Arun P. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;