Skip to content

Order of elements not updating on change items #14

@timur560

Description

@timur560

Code:

<sortable-list class="items-sortable" on-sort-finish="_onSortFinish" dragging="{{dragging}}"
          sortable=".item" items="{{someItemsSorted}}">
  <template is="dom-repeat" items="[[itemsUpdatableFromApi]]">
    <div class="item"> ....
  ...
...

This issue is that when itemsUpdatableFromApi variable is changing, and the order of them changed, the order of items in component keep not changed. However, the data in items is updating correctly.

To clarify the issue I will describe steps:

  1. Items in sortable-list:
<div id="51">1</div>
<div id="52">2</div>
<div id="53">3</div>
  1. Move item with id 53 up:
<div id="51">1</div>
<div id="53">3</div>
<div id="52">2</div>
  1. Send API request on on-sort-finish to change the priorities (sort order)
  2. Update the items (in code above we just change the property itemsUpdatableFromApi with data, fetched from API)
<div id="51">1</div>
<div id="52">3</div>
<div id="53">2</div>

So, the id is changed and this is the correct data, but the order of displaying should be changed too. Because from API I receive items correctly ordered by priority (1,2,3)). But when I refresh the page, the order of items is correct:

<div id="51">1</div>
<div id="53">2</div>
<div id="52">3</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions