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.

Autocomplete - Load records dynamically

Thread ID:

Created:

Updated:

Platform:

Replies:

119278 May 31,2015 09:58 AM Aug 8,2015 08:47 AM WPF 13
loading
Tags: AutoComplete
Fabio Henrique Baptista
Asked On May 31, 2015 09:58 AM

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!

Mariappan S [Syncfusion]
Replied On June 1, 2015 07:07 AM

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

Fabio Henrique Baptista
Replied On June 1, 2015 12:01 PM

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

Mariappan S [Syncfusion]
Replied On June 2, 2015 09:42 AM

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.

Fabio Henrique Baptista
Replied On June 2, 2015 12:00 PM

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

Mariappan S [Syncfusion]
Replied On June 3, 2015 08:39 AM

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.

Fabio Henrique Baptista
Replied On June 3, 2015 12:14 PM

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

Mariappan S [Syncfusion]
Replied On June 4, 2015 05:12 AM

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

Losfeld Christ
Replied On August 3, 2015 05:36 AM

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.


Priyanga Balasubramaniam [Syncfusion]
Replied On August 4, 2015 08:58 AM

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

Losfeld Christ
Replied On August 4, 2015 09:39 AM

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.


Priyanga Balasubramaniam [Syncfusion]
Replied On August 5, 2015 08:46 AM

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

Losfeld Christ
Replied On August 6, 2015 04:46 AM

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

Priyanga Balasubramaniam [Syncfusion]
Replied On August 8, 2015 08:47 AM

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

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.

;