Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
140
UltraCombo BindingList bulk update?
posted

Hello,

I'm working on an infinite scroll dropdown, and having some issues with trying to figure out to do a bulk update of the underlying list.

We decided to go with a BindingList, so that we could set the data source once, and as the user scrolls update what's in the list (rather than re-applying the DataSource) so the scroll position would be kept.

My problem is with performance. 

If there are 5,000 total records in my dropdown, and I want to show about 1,000 at a time, I add or remove items (the same static placeholder to start) until my BindingList has 5,000 records in it. Then, depending on where the offset is, I update those 1,000 records to the proper "page" from the server.

With that data size, the first time I update my list, there are 6,000 updates sent to the UltraCombo, and it just locks up. Subsequent updates are still 1,000 (or more if the total size changes).

Is there a way to properly bulk update a BindingList that'll play nice with an UltraCombo?

I've tried:

  • Setting RaiseListChangedEvents = false at the start, then once my list is updated, set it back to true, but that doesn't seem to fire an event when it's set back to true to let the control know to update. My dropdown stays blank.
  • Doing that, but then updating one single record within the list (e.g. Items[0] = Items[0]). Seems hacky, though it works in certain cases, but not always. If I type in several characters to filter down to only one or two results, then delete them all (so my list goes from 5,000 to 5, back to 5,000), my dropdown stays at 5 in the UI and closing/reopening doesn't seem to trigger a refresh.
  • Instead, after setting RaiseListChangedEvents back to true, calling ResetBindings on the list. This works extremely well, EXCEPT, it causes my scroll to jump back up to the top.

I've also tried a handful of the various refresh/invalidate/pairing beginupdate and endupdate methods on the control or its rows, but they don't seem to work.

I'm not necessarily married to a binding list if there is a better implementation. I really just want to be able to tell an UltraCombo, while it's open, to update the 1,000 or so adjacent records.

Thanks!

Parents
  • 140
    Verified Answer
    Offline posted

    Update:

    Got this working! The key was using BeginUpdate // EndUpdate in UltraControlBase. This pseudo code worked:

    dropdown.BeginUpdate();

    /* Get data here */

    bindingList.RaiseListChangedEvent = false;

    /* Do all updates to binding list except one */

    bindingList.RaiseListChangedEvents = true;

    /* Do final update to binding list */

    dropdown.EndUpdate(true);

    The performance is still fast, and it keeps the scroll position as it updates the list.

Reply Children
No Data