apache / apache/royale-asjs

Binding with {} vs binding mxml (ConstantBinding)

Open
#1,244 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

I am experimenting with Binding, specifically I am trying to bind the “dataProvider” property, of a Jewel List control, with a “dataProv” property, of the mxml view; my goal is that when I update the dataProv property the dataProvider property of the list is updated.

Binding with “{}” works perfectly, but binding through “ConstantBinding” works when the bead is initialized (set strand) but never updates the list's dataProvider again.

We can observe this behavior in the “[TabBarPlayGround](https://github.com/apache/royale-asjs/blob/develop/examples/jewel/TourDeJewel/src/main/royale/TabBarPlayGround.mxml)” view of the TDJ with the first two TabBars:

1º)
` `

2º)
```



```

```
private var _tabBarData:ArrayList = new ArrayList([
new TabBarButtonVO("Tab 1", "tab1", MaterialIconType.ACCESSIBILITY),
new TabBarButtonVO("Tab 2", "tab2", MaterialIconType.ACCESS_ALARMS),
new TabBarButtonVO("Tab 3", "tab3", MaterialIconType.WALLPAPER),
new TabBarButtonVO("Tab 4", "tab4", MaterialIconType.NATURE)
]);

[Bindable]
public function get tabBarData():ArrayList
{
return _tabBarData;
}
public function set tabBarData(value:ArrayList):void
{
_tabBarData = value;
}
private function updateTabBarData():void
{
tabBarData = new ArrayList([
new TabBarButtonVO("Other Tab 1", "tab1", MaterialIconType.MORE),
new TabBarButtonVO("Other Tab 2", "tab2", MaterialIconType.PAGES),
new TabBarButtonVO("Other Tab 3", "tab3", MaterialIconType.ZOOM_IN)
]);
}

```
When tabBarData is updated, updateTabBarData(), changes are reflected in the first TabBar but not in the second.
Is this performance as expected? Should another bead be used?

Thx

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with examples/jewel/TourDeJewel/src/main/royale/TabBarPlayGround.mxml and compare the first TabBar's {} binding with the second TabBar's ConstantBinding bead. Reproduce updateTabBarData() and trace ConstantBinding updates after initialization; done means the second TabBar's dataProvider reflects the replacement tabBarData as the first one does.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.