Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Dec 11, 2020 @ 01:27
    Alex Skrypnyk
    0

    Backoffice ng-repeat with thousands of items

    Hi Community,

    We are trying to find a solution for displaying 10k checkboxes in the Umbraco back office that rendered with ng-repeat. We've realized that angularJs are not able to perform more than 2500 items in ng-repeat with data-binding.

    I'm thinking about rendering parts of the array during the user scrolls the page, or it will be too much for ng-repeat as well?

    Any recommendations?

    Thanks,

    Alex

  • Chriztian Steinmeier 2800 posts 8791 karma points MVP 8x admin c-trib
    Dec 11, 2020 @ 10:26
    Chriztian Steinmeier
    3

    Hi Alex,

    Are these going to be toggled by editors? Can't imagine anyone wanting to scroll through a list of 10.000 items to find the ones they want to toggle - regardless of them being lazy-loaded while scrolling, or loaded at once.

    Is there no way you can categorize them, so the ones you do end up showing are the ones the editor would need to toggle?

    A regular form with 10.000 checkboxes wouldn't necessarily feel sluggish — just very long, but I can only imagine that any kind of JS-powered list would be much worse... typically at least double the number of attributes in the markup alone, and eventhandlers all over...

    (Sorry if this feels like a Stack Overflow knee-jerk reaction but I'm utterly fascinated by what makes 10.000 checkboxes necessary...)

    /Chriztian

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Dec 11, 2020 @ 13:59
    Alex Skrypnyk
    0

    Hi Chriztian

    Thanks for your input. I totally agree with you that rendering thousands of checkboxes is a bad idea in any case, I can't imagine how editors will use this list.

    But this is what the client asking for and change the design isn't something he would like to do.

    An interesting fact that this control was built with asp web forms and it worked much better than a new one with AngularJS :)

    I'm thinking now about Virtual scroll as a way to go - https://github.com/stackfull/angular-virtual-scroll

    Thanks, Alex

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Dec 11, 2020 @ 18:14
  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Dec 12, 2020 @ 06:27
    Nathan Woulfe
    3

    Pagination and search/filter will be your friends. There's no need to display 10k items at once - human brain can manage lists of 6-8 items at time.

  • Bjarne Fyrstenborg 1284 posts 4038 karma points MVP 8x c-trib
    Dec 12, 2020 @ 16:16
    Bjarne Fyrstenborg
    2

    Like Nathan says if rendering a list using ng-repeat with many items, so should use a paged result. In fact more than 500 - 1000 items are causing memory issues in the browser, because it is rendering many DOM elements.

    I would render the list as a paged result - you can using PagedResult<T> from Umbraco core and contruct a model with the neccessary properties. https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Core/Models/PagedResultOfT.cs

    Furthermore you can use the <umb-pagination> component or use infinite loading as the user scroll or via a "load more" button.

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Dec 18, 2020 @ 14:46
    Alex Skrypnyk
    0

    Pagination and search/filter definitely the best idea, but the requirement is to build a list of 10k+ checkboxes on the page in 3 levels lists and nesting.

    Of course, it's impossible to use for humans brains, but I have to make the browser do not freeze when it's loaded.

  • Bo Jacobsen 607 posts 2405 karma points
    Dec 18, 2020 @ 15:14
    Bo Jacobsen
    1

    Hi Alex.

    While i dont think that you can make AngularJs repeat over 500 items very fast. I still think that Angular Material would be the way to go -> https://material.angularjs.org/latest/demo/virtualRepeat

    Another thing you could do, is to make a UserControl and render it with asp web forms. I know its an old way, but maybe it could save you.

  • Alex Skrypnyk 6168 posts 24148 karma points MVP 8x admin c-trib
    Dec 18, 2020 @ 18:28
    Alex Skrypnyk
    100

    Hi,

    Thanks, it's a great idea; I've installed Angular Material virtual repeat, which works fast enough. This approach's disadvantage is that you have to change CSS to make it look as you want.

    WebForms isn't an option at this point, sadly or luckily :) it would be interesting to build something in WebForms :)

    Thanks, Alex

Please Sign in or register to post replies

Write your reply to:

Draft