Skip to content

Parents binding in ListView item templates is not working until ListView is refreshed. #5054

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

Closed
HunterJS-bit opened this issue Nov 9, 2017 · 4 comments

Comments

@HunterJS-bit
Copy link

HunterJS-bit commented Nov 9, 2017

Tell us about the problem

Hello guys I have a quick question I searched forums but couldnt find answer
How can I display my observable in parents if I have 2 or 3 of them
like this:

<Button text="{{ $parents['RadListView'].name + " "+ "$parents['RadListView'].surname" ]] }}" />

This above doesnt works or only gives me one item but what if I want two of them or tree displayed ????

Which platform(s) does your issue occur on?

iOS/Android/Both

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.2.0

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@NickIliev NickIliev self-assigned this Nov 9, 2017
@NickIliev NickIliev added the bug label Nov 9, 2017
@NickIliev
Copy link
Contributor

@markomiljkovic

There are a number of syntax errors in the your Button XML line.
You have double quotes for your second binding and also some closing brackets at the end that are not needed.

Here is the refactored code that will work

<Button text="{{ $parents['RadListView'].name + '  '+ $parents['RadListView'].surname }}" />

Demo application demonstrating the above syntax can be found here.

Meanwhile, it appears that you might have to manually refresh the list view to update all parents binding in the item templates.

Logging this one as a bug - steps to reproduce use the linked application and
remove the manual refresh of the list. As a result, the binding will appear only for the few first items or only after the list is scrolled.

@NickIliev NickIliev changed the title Question: Displaying parents in xml Parents binding in ListView item templates is not working until ListView is refreshed. Nov 9, 2017
@HunterJS-bit
Copy link
Author

thank you very much its working :)

@NickIliev
Copy link
Contributor

Reproducible with tns-core-modules@next

@NathanWalker
Copy link
Contributor

NathanWalker pushed a commit that referenced this issue Aug 7, 2020
NathanWalker pushed a commit that referenced this issue Aug 7, 2020
tarunama pushed a commit to tarunama/NativeScript that referenced this issue Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants