Skip to content
Snippets Groups Projects

Feature/growth insertion index

Merged Timo Koch requested to merge feature/growth-insertion-index into master

Feature request


  • Each element has a growthInsertionIndex that can be queried using a grid method with the same name.
  • This index is only valid between calling grow() and postGrow() and only for elements that have been inserted using the grids insertElement method.
  • It can be used to attach user data to an element inserted with the insertElement method, because we don't know at insertion time (before calling grow()) which index or id the element will have in the grid.
  • The concept is very similar to the insertionIndex of the factory with the difference that the validity of the index is only temporary.

I'm open to any suggestion how to make this better or also renaming of the interface function. Without this it's impossible to attach data to a newly created element at creation time, i.e. it's impossible to distinguish between new elments that were inserted together using insertElement().

This branch is based on !14 (merged)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Do we really need this complexity? If the current grid has elements with indices 0 ... n-1, then if I grow an additional element will have index n, right? And if I grow a second element it gets n+1. Why do I need the new methods? "Conforming to existing practices" does not really convince me, as no other grid does growth anyway.

  • Author Owner

    The problem is the following:

    • We queue all elements to insert before actual insertion
    • After I call grow() the id/index gets determined but it might not be the consecutive insertion order since
      • some elements might not have been inserted (not all elements are guaranteed to be inserted because we have some restrictions on possible elements)
      • elements might have been removed in the same growth step

    So the problem is the same as for the grid factory. It's currently not possible to attach user data to new elements on creation and I currently have a used case for that where I can't think of another possibility to create/attach my user data.

    Edited by Timo Koch
  • Okay. If you see no other way then go ahead and merge.

  • Author Owner

    Ok this works nicely after some testing. So I'll merge.

  • Timo Koch mentioned in commit a33c11bc

    mentioned in commit a33c11bc

  • Timo Koch Status changed to merged

    Status changed to merged

Please register or sign in to reply
Loading