Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iron-list dynamic change items, when each item is object #43

Closed
ledoramy opened this issue Jul 28, 2015 · 2 comments
Closed

iron-list dynamic change items, when each item is object #43

ledoramy opened this issue Jul 28, 2015 · 2 comments

Comments

@ledoramy
Copy link

I don't sure is it an issue but i have problems with dynamic change of items content.

For example, I have an array of same objects with some fields and i put in iron-list as items.
In each item i show info from object, it works well.

But I need to edit some items, add or delete some text, when I do that nothing happens, iron-list
not re rendered, model of iron-list is updated after changes if I check this.$.list.items, I see that some fields of object in array were changed, but this new info not show in list, it show old info,
even this.$.list._update() doesn't help.

here is simple example
http://jsbin.com/pefecihayi/edit?html,console,output

@blasten
Copy link
Contributor

blasten commented Jul 28, 2015

You need to use list.set('items.0.name', 'some value') to properly change the name of the 0th item.
http://jsbin.com/yayefe/edit?html,output

@blasten blasten closed this as completed Jul 28, 2015
@ledoramy
Copy link
Author

I know about that and I'am using this method now - list.set('items.0.name', 'some value'), it's good when you know that you need to change only one property in object or your object consists from few fields . But if you have object which has 20 or more fields, and user can edit every field in this object or just few fields, and after editing he wants to see updated list.

To update item info I implemented it like these:

       var item = document.querySelector('#list').get('items.' + index);
        for(var arg in item) {
          document.querySelector('#list').set('items.' + index + '.' + arg, updatedObject[arg]);
        } 

And yes I used _refreshAll() method and it packed all iron-list items in one line whithout updating info from object fields.

And I think it's wrong behavior when model of iron-list which is items is updated but you can't see it in your list, becouse it continues to show old info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants