Posted 27 February 2024, 2:57 am EST
- We are building a Blazor Page where we want the user to enter an “item number”.
- The items datasource is an sql table with thousands of entries.
- The items are available as a model through an Entity Framework DB context.
My thoughts were that the best way to do this is
- C1AutoComplete for the entry box, and
- C1EntityFrameworkCoreVirtualDataCollection as a datacollection to bind to the auto complete box.
Having a VirtualDataCollection means that the thousands of entries do not have to be all loaded.
Function
User types the first couple of letters, and the collection is searched and displays matching records in the autocomplete drowndown that the user can choose…
Issues
-
The autocomplete list’s scrollbar resets to the top after dynamically loading more entries, disrupting the user’s scrolling. When the user scrolls the autocomplete list to rows that have not loaded yet: The entries dynamically load, but the list auto scrolls back to the first entry after loading. In other words, the scroll bar jumps on the user, and goes back to the home position (first entry in list) while the user is scrolling. This happens both for when the user clicks the dropdown with no text in the box (so for all records), and also if the user has filtered for say “AAA” and there are 50 records, it also happens when they start scrolling in that scenario.
-
After an item has been selected, if the user presses the dropdown again it shows all items - is there a way to get it to only show the item the user has selected/is currently filtered for? Instead of the full list.
Additional Concerns
- I’m not sure if this is the best way to tackle the requirements.
- I’m reevaluating if C1AutoComplete and C1EntityFrameworkCoreVirtualDataCollection are optimal for our needs. I choose them after browsing through the different controls and collections I could find.
- I’m open to suggestions for alternative approaches or components.
I’ve gone ahead and attached my .Razor file to this post, but let me know if you require a full sample. The solution is hooked up to our database server, and also has a bunch of other stuff, so I would need to make a separate app and simulate the data.
Your answer to my questions and any other advice and samples you can provide would be most helpful. I’ve found it hard to find detailed docs and samples for the Blazor Control and Data stuff. I’ve mainly used Mescius WinForms stuff over the years, and have only just started with Blazor.