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. Image for the cookie policy date

Autocomplete - Load records dynamically

Hello, how can I configure the component to auto complete for dynamically load the items, based on what is entered in a database with lots of records?
Thank you!

16 Replies

MS Mariappan S Syncfusion Team June 1, 2015 11:07 AM UTC

Hi Fabio,

Thank you for contacting Syncfusion support.

We have prepared a sample which tries to meet your requirement. In this sample we can loaded BusinessObject collection in AutoComplete and it will show the collection depending on the typed character and we have added items dynamically in button click. This will also showed in dropdown when enter this character in AutoComplete. If your requirement differs from this sample please give more information about your requirement.

Please download the sample from the below link

Sample link: AutoCompleteSample


Please let us know if you need further assistance.

Regards,
Mariappan S


FH Fabio Henrique Baptista June 1, 2015 04:01 PM UTC

Hi,

Thank you for your help

The goal was not to fill the component with all the items in the creation, the ideal would be to load the information demand for database as soon as the User enter the word to search.

I made some modifications to the attached project, to try to better present the need.

However, I could not get it to work properly.

thank you

Attachment: AutoCompleteSample_ca22ebb0.zip


MS Mariappan S Syncfusion Team June 2, 2015 01:42 PM UTC

Hi Fabio,

Thank you for your update.

In our AutoComplete control we have a Filtering and AutoAppend feature which will get performed in PreviewMouseDown event and display the items. We have checked your updated sample, in this you have loaded the  CustomSource in KeyUp event where we have filtered in “PreviewMouseDown” event. Can you please explain why you have done the filter operation again in “KeyUp” event? Also please explain your requirement clearly, this would be very helpful for us to resolve your problem earlier.

Please let us know if you need further assistance.

Regards,
Mariappan S.


FH Fabio Henrique Baptista June 2, 2015 04:00 PM UTC

Hi,

Yes, the component performs filtering every keystroke, however, from what I endenti this filtering is done on a list of records that was linked to CustomSource the component creation.

I wonder then, that having a database of 100.000 customers, would be carrying a list with all customers, and these information Do in memory, the component would filter and present me just what contains the word you typed.

What did you expect would be a form of rather to link all customer record, I could retrieve them already filtered, thus decreasing the amount of records and after that add to the list CustomSource.

Basically it is what is in compoentes autocomplete for web environment.

Get the database only record already filtered, so this is not done in memory.

However, I may be wrong and not having properly understood the functionality that compoente already provides, this is the situation?

thank you again
Fabio


MS Mariappan S Syncfusion Team June 3, 2015 12:39 PM UTC

Hi Fabio,

Thank you for your update.

We have modified your sample which tries to meet your requirement. In this sample we can get key stroke in PreviewKeyDown event to filter the typed character collection in AutoComplete control.

Please download the sample from the below link

Sample link: AutoCompleteSample


Please let us know if you need further assistance.

Regards,
Mariappan S.


FH Fabio Henrique Baptista June 3, 2015 04:14 PM UTC

Hi,

That was it what you expected, despite having a side effect with dropdwon, disappearing and appearing every keystroke, filtering is correct.

Thank you for help
Fabio


MS Mariappan S Syncfusion Team June 4, 2015 09:12 AM UTC

Hi Fabio,

Thank you for your update.

We have set the CustomSource to AutoComplete in every key stroke, so when we type each key the CustomSource is refreshed and PopUp is opened again.

Please let us know if you need any other assistance.

Regards,
Mariappan


LC Losfeld Christ August 3, 2015 09:36 AM UTC

Hello,

We have almos the same issue, except that we are working in mvvm and it's not a database which is giving us the data, but a wcf service.
Could you please prepare us a sample, which is doing the same, but without code behind ? 
We've created the following code within our xaml.  But the source content change happens only when the user goes back on the last character and types it again.  The data is loaded asynchronously.

<syncfusion:SfTextBoxExt x:Name="MnemonicField" Grid.Row="4" Grid.Column="1" MinWidth="100" MaxWidth="350" Width="100" HorizontalAlignment="Left"

AutoCompleteSource="{Binding FoundCandidates, Mode=TwoWay, UpdateSourceTrigger=Default}"

Text="{Binding SearchMnemonic, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="5" SearchItemPath="SearchField" Watermark="Search Metering Code" MinimumPrefixCharacters="2" AutoCompleteMode="Suggest"

IsHitTestVisible="{Binding ControlsEditable}" Focusable="{Binding ControlsEditable}" Visibility="{Binding MeteringCodeVisibility}" IsSuggestionOpen="{Binding SuggestionIsOpen}"

HorizontalContentAlignment="Left" VerticalContentAlignment="Center" >

<syncfusion:SfTextBoxExt.AutoCompleteItemTemplate>

<DataTemplate>

<StackPanel Orientation="Horizontal">

<TextBlock Text="{Binding Mnemonic}" Margin="5"/>

<TextBlock Text="{Binding Putm}" Margin="5"/>

</StackPanel>

</DataTemplate>

</syncfusion:SfTextBoxExt.AutoCompleteItemTemplate>

</syncfusion:SfTextBoxExt>


Hoping you can help us,


Best regards,

Christ.



PB Priyanga Balasubramaniam Syncfusion Team August 4, 2015 12:58 PM UTC

Hi Losfeld,

In our last updated sample we have provided it in AutoComplete control. But you have updated the code snippet in SfTextBoxExt. Can you please explain whether you try to achieve the same behavior in this control? You have also mentioned that "the source content change happens only when the user goes back on the last character and types it again". Can you please explain this issue clearly. It would helpful for us to proceed further.

We have attached a sample which is created using your updated code snippet. Please download it from the below link

Sample: SfTextBox_sample

Please let us know if you need any other assistance.

Regards,
Priyanga B


LC Losfeld Christ August 4, 2015 01:39 PM UTC

Hi, thanks Priyanga for you reply...

Well here you see the screen we need to develop, the users needs to select a metering code starting from 3 characters we are going to consult a wcf service which delivers us a list based on a mask (in this case AAL), but we needed to remove the L (the user needed to do that) so that we could see the list below otherwise no list is shown.

The user introduces a number of characters (to be correct 3 or more) as from the moment that 3 characters are filled in the wcf service behind will retrieve from a service provider the list of codes.  But seen the fact that this happens async, the list given, but the update event of the "editbox" is closed.  So we assume that the listbox is not shown due to this reason.  When we remove one character (as user) we see the list. 

About the snippet, we followed the sample from the essential studio WPF :


But if you can make it work with your autocomplete box in mvvm, we are willing to use that.

Best regards,

Christ.



PB Priyanga Balasubramaniam Syncfusion Team August 5, 2015 12:46 PM UTC

Hi Losfeld,

Thank you for your update.

We have attached a sample which is created using AutoComplete control in MVVM pattern. In this sample the autosuggestion gets displayed for every letter which is typed or erased. Can you please look into this sample and let us know whether this is your requirement? If your requirement is differs from this sample please provide more information about your requirement.

Please download the sample from the below link

Sample link: AutoCompleteSample

Regards,
Priyanga B


LC Losfeld Christ August 6, 2015 08:46 AM UTC

Hello Priyanga Balasubramaniam,

I've adapted your sample to work in the way we work here.  You have to know that we are working in a n-tier environment, so the data is coming from a service onto the client. 

The Autocomplete component works great, but we (my customer/business) would like to see the list directly once there is one or more item available to select.  Currently the box doesn't behave that way.  That is one of the reason that we used sfTextBoxExt.  But in that case we have the issue that or the listbox doesn't fillup or the listbox isn't refreshed.

To help you in your research, I've attached my sample, so that you can try to make it work :D.

Best regards,

Christ

Attachment: AutoCompleteSample_f8c56c4f.zip


PB Priyanga Balasubramaniam Syncfusion Team August 8, 2015 12:47 PM UTC

Hi Losfeld,

Thanks for your patience.

We have checked your sample. There you have loaded data Asynchronously using Threading concept(Task.Run()) and filtered each input by your own and result passed to the control, this makes problem while using multi select option. When we load data Synchronously both Autocomplete and SfTextBox are working fine. Can you please explain reason for loading data Asynchronously in your application?

We have modified your sample. In this sample data loaded Synchronously.

Sample:AutoCompleteSample

Regards,
Priyanga


PH Philippe April 15, 2019 08:25 PM UTC

Dear,

If the internet connexion is slow and if the loaded is synchronously, the GUI stop during the loading.
If the loaded is asynchronously, the suggest panel doesn't appears until the user type another character or clic on the object.

Do you have an example where the AutoCompleteSource is loaded aynchronously with MVVM ?
Best regards



PH Philippe April 18, 2019 04:33 PM UTC

Dear,

I created a small project to explain the problem.
In the BOMViewModel.cs file you can change Asynchronous to Synchronous.

Type "Tes" in the SfTextBoxExt to see the differences.
Do you have a solution ? Is it possible to force the refresh of the SfTextBoxExt at the end of the Thread ?

Best regards
Philippe

Attachment: ProjetTest_6815891e.zip


RB Rabhia Beham Kathar Mideenar Syncfusion Team April 22, 2019 12:28 PM UTC

Hi Philippe, 

We have checked your requirement in SfTextBoxExt from our side. Currently, we do not have " Load data Asynchronously in SfTextBoxExt". We are considering this as a feature request. We thank you for requesting this feature and helping us define it. We have added this feature request to our database. You can now track the current status of this feature request here. 

Feedback link:  https://www.syncfusion.com/feedback/5880/load-data-asynchronously-in-sftextboxext


This feature will be available in any of our upcoming release. So, you can keep track of the feature from the above link.

Regards,
Rabhia Beham K.
 


Loader.
Live Chat Icon For mobile
Up arrow icon