Data Binding problem

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Data Binding problem

De Carli Gustavo

Hello.

I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .
Don't load the data for default.

Thk.



<?xml version="1.0" encoding="utf-8"?>
<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                xmlns:j="library://ns.apache.org/royale/jewel"
                xmlns:js="library://ns.apache.org/royale/basic"                
                width="100%"
                height="100%">

    <fx:Script>
         <![CDATA[
            import org.apache.royale.events.Event;
            import org.apache.royale.collections.ArrayList;

            [Bindable]
            private var data:ArrayList = new ArrayList( [
                                                    {label:'Africa' ,code:'001'},
                                                    {label:'America',code:'002'},
                                                    {label:'Asia'   ,code:'003'},
                                                    {label:'Europa' ,code:'004'},
                                                    {label:'Oceania',code:'005'},
                                                ]);

             private function refresh(e:Event):void {
               dg.dataProvider = this.data;
            }
        ]]>
    </fx:Script>

    
    <j:initialView>
        <j:View>
            <j:DataGrid id="dg" 
                        width="400" 
                        height="200"
                        dataProvider="{data}">
                <j:columns>
                    <j:DataGridColumn label="Label" dataField="label"/>
                    <j:DataGridColumn label="Code"  dataField="code"/>
                </j:columns>
            </j:DataGrid>
            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>
        </j:View>
    </j:initialView>
</j:Application>
Reply | Threaded
Open this post in threaded view
|

RE: Data Binding problem

yishayw

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 



    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 



            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 



             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 



    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Data Binding problem

De Carli Gustavo
Hello Yishay, thank, with ApplicationDataBinding work !
I understand that I can shorten the level of "binding", so I am trying to use "ViewDataBinding" without success
Is it recommended to use "ApplicationDataBinding"? or is less performant


Thank very much.
Gustavo.

El mié., 5 feb. 2020 a las 10:02, Yishay Weiss (<[hidden email]>) escribió:

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 



    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 



            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 



             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 



    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

Reply | Threaded
Open this post in threaded view
|

RE: Data Binding problem

yishayw

As I understand it the bead you use depends on your document type. If your root tag were a View you would use ViewDataBinding. I’m not aware of performance differences but I wasn’t involved in writing Binding so others may want to comment.

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 3:35 PM
To: [hidden email]
Subject: Re: Data Binding problem

 

Hello Yishay, thank, with ApplicationDataBinding work !

I understand that I can shorten the level of "binding", so I am trying to use "ViewDataBinding" without success

Is it recommended to use "ApplicationDataBinding"? or is less performant

 

 

Thank very much.

Gustavo.

 

El mié., 5 feb. 2020 a las 10:02, Yishay Weiss (<[hidden email]>) escribió:

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 

 

    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 

 

            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 

 

             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 

 

    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: Data Binding problem

Carlos Rovira-2
Hi,

as Yishay said, each component/container type has its own binding bead:

  • Application - ApplicationDataBinding
  • View - ViewDataBinding
  • Container - ContainerDataBinding

El mié., 5 feb. 2020 a las 16:52, Yishay Weiss (<[hidden email]>) escribió:

As I understand it the bead you use depends on your document type. If your root tag were a View you would use ViewDataBinding. I’m not aware of performance differences but I wasn’t involved in writing Binding so others may want to comment.

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 3:35 PM
To: [hidden email]
Subject: Re: Data Binding problem

 

Hello Yishay, thank, with ApplicationDataBinding work !

I understand that I can shorten the level of "binding", so I am trying to use "ViewDataBinding" without success

Is it recommended to use "ApplicationDataBinding"? or is less performant

 

 

Thank very much.

Gustavo.

 

El mié., 5 feb. 2020 a las 10:02, Yishay Weiss (<[hidden email]>) escribió:

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 

 

    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 

 

            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 

 

             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 

 

    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

 



--
Reply | Threaded
Open this post in threaded view
|

Re: Data Binding problem

De Carli Gustavo

Carlos, sorry the ViewDataBinding , 
Is it well applied?
The grid and the input text do not show values.

Thank

<?xml version="1.0" encoding="utf-8"?>
<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic"
width="100%"
height="100%">
<fx:Script>

<![CDATA[
import org.apache.royale.collections.ArrayList;

[Bindable]
public var texto:String = "Hello World";

[Bindable]
public var data:ArrayList = new ArrayList( [
{label:'Africa' ,code:'001'},
{label:'America',code:'002'},
{label:'Asia' ,code:'003'},
{label:'Europa' ,code:'004'},
{label:'Oceania',code:'005'},
]);

]]>
</fx:Script>

<!-- WITH THIS CODE , WORK !
<j:beads>
<js:ApplicationDataBinding/>
</j:beads>
-->
<j:initialView>
<j:View>
<!-- THIS BEAD IS OK ? -->
<j:beads>
<js:ViewDataBinding/>
</j:beads>
<j:TextInput id="txtInputBinding" text="{texto}"/>
<j:DataGrid id="dg" dataProvider="{data}">
<j:columns>
<j:DataGridColumn label="Label" dataField="label"/>
<j:DataGridColumn label="Code" dataField="code"/>
</j:columns>
</j:DataGrid>
</j:View>
</j:initialView>
</j:Application>

El mié., 5 feb. 2020 a las 15:00, Carlos Rovira (<[hidden email]>) escribió:
Hi,

as Yishay said, each component/container type has its own binding bead:

  • Application - ApplicationDataBinding
  • View - ViewDataBinding
  • Container - ContainerDataBinding

El mié., 5 feb. 2020 a las 16:52, Yishay Weiss (<[hidden email]>) escribió:

As I understand it the bead you use depends on your document type. If your root tag were a View you would use ViewDataBinding. I’m not aware of performance differences but I wasn’t involved in writing Binding so others may want to comment.

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 3:35 PM
To: [hidden email]
Subject: Re: Data Binding problem

 

Hello Yishay, thank, with ApplicationDataBinding work !

I understand that I can shorten the level of "binding", so I am trying to use "ViewDataBinding" without success

Is it recommended to use "ApplicationDataBinding"? or is less performant

 

 

Thank very much.

Gustavo.

 

El mié., 5 feb. 2020 a las 10:02, Yishay Weiss (<[hidden email]>) escribió:

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 

 

    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 

 

            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 

 

             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 

 

    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

 



--
Reply | Threaded
Open this post in threaded view
|

Re: Data Binding problem

Carlos Rovira-2
Hi,

As Yishay pointed before, the document root tag is the important one here.
For Application is ApplicationDataBinding.
You can move the view to a new file and make it root of that file, in that case you use ViewDataBinding

HTH

Carlos


El mié., 5 feb. 2020 a las 19:29, De Carli Gustavo (<[hidden email]>) escribió:

Carlos, sorry the ViewDataBinding , 
Is it well applied?
The grid and the input text do not show values.

Thank

<?xml version="1.0" encoding="utf-8"?>
<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic"
width="100%"
height="100%">
<fx:Script>

<![CDATA[
import org.apache.royale.collections.ArrayList;

[Bindable]
public var texto:String = "Hello World";

[Bindable]
public var data:ArrayList = new ArrayList( [
{label:'Africa' ,code:'001'},
{label:'America',code:'002'},
{label:'Asia' ,code:'003'},
{label:'Europa' ,code:'004'},
{label:'Oceania',code:'005'},
]);

]]>
</fx:Script>

<!-- WITH THIS CODE , WORK !
<j:beads>
<js:ApplicationDataBinding/>
</j:beads>
-->
<j:initialView>
<j:View>
<!-- THIS BEAD IS OK ? -->
<j:beads>
<js:ViewDataBinding/>
</j:beads>
<j:TextInput id="txtInputBinding" text="{texto}"/>
<j:DataGrid id="dg" dataProvider="{data}">
<j:columns>
<j:DataGridColumn label="Label" dataField="label"/>
<j:DataGridColumn label="Code" dataField="code"/>
</j:columns>
</j:DataGrid>
</j:View>
</j:initialView>
</j:Application>

El mié., 5 feb. 2020 a las 15:00, Carlos Rovira (<[hidden email]>) escribió:
Hi,

as Yishay said, each component/container type has its own binding bead:

  • Application - ApplicationDataBinding
  • View - ViewDataBinding
  • Container - ContainerDataBinding

El mié., 5 feb. 2020 a las 16:52, Yishay Weiss (<[hidden email]>) escribió:

As I understand it the bead you use depends on your document type. If your root tag were a View you would use ViewDataBinding. I’m not aware of performance differences but I wasn’t involved in writing Binding so others may want to comment.

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 3:35 PM
To: [hidden email]
Subject: Re: Data Binding problem

 

Hello Yishay, thank, with ApplicationDataBinding work !

I understand that I can shorten the level of "binding", so I am trying to use "ViewDataBinding" without success

Is it recommended to use "ApplicationDataBinding"? or is less performant

 

 

Thank very much.

Gustavo.

 

El mié., 5 feb. 2020 a las 10:02, Yishay Weiss (<[hidden email]>) escribió:

Have you tried adding ApplicationDataBinding? See example [1]

 

[1] https://royale.apache.org/binding-the-text-property-of-a-jewel-textinput-to-update-a-text-label/

 

From: [hidden email]
Sent: Wednesday, February 5, 2020 12:15 AM
To: [hidden email]
Subject: Data Binding problem

 

 

Hello.


I do not find what the concept of error is because it does not work "binding" from the beginning, but in the method refresh  .

Don't load the data for default.

 

Thk.

 

 

 

 

<?xml version="1.0" encoding="utf-8"?>

 

<j:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

 

                xmlns:j="library://ns.apache.org/royale/jewel"

 

                xmlns:js="library://ns.apache.org/royale/basic"                

 

                width="100%"

 

                height="100%">

 

 

    <fx:Script>

 

         <![CDATA[

 

            import org.apache.royale.events.Event;

 

            import org.apache.royale.collections.ArrayList;

 

 

            [Bindable]

 

            private var data:ArrayList = new ArrayList( [

 

                                                    {label:'Africa' ,code:'001'},

 

                                                    {label:'America',code:'002'},

 

                                                    {label:'Asia'   ,code:'003'},

 

                                                    {label:'Europa' ,code:'004'},

 

                                                    {label:'Oceania',code:'005'},

 

                                                ]);

 

 

             private function refresh(e:Event):void {

 

               dg.dataProvider = this.data;

 

            }

 

        ]]>

 

    </fx:Script>

 

 

    

 

    <j:initialView>

 

        <j:View>

 

            <j:DataGrid id="dg" 

 

                        width="400" 

 

                        height="200"

 

                        dataProvider="{data}">

 

                <j:columns>

 

                    <j:DataGridColumn label="Label" dataField="label"/>

 

                    <j:DataGridColumn label="Code"  dataField="code"/>

 

                </j:columns>

 

            </j:DataGrid>

 

            <j:Button id="btnRefresh" text="Refresh Me" click="refresh(event)"/>

 

        </j:View>

 

    </j:initialView>

 

</j:Application>

 

 

 



--


--
Reply | Threaded
Open this post in threaded view
|

Re: Data Binding problem

De Carli Gustavo
Excelent, Thanks Carlos

<?xml version="1.0" encoding="utf-8"?>
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic">

<fx:Script>

<![CDATA[
import org.apache.royale.collections.ArrayList;

[Bindable]
public var texto:String = "Hello World";

[Bindable]
public var data:ArrayList = new ArrayList( [
{label:'Africa' ,code:'001'},
{label:'America',code:'002'},
{label:'Asia' ,code:'003'},
{label:'Europa' ,code:'004'},
{label:'Oceania',code:'005'},
]);

]]>
</fx:Script>

<j:beads>
<js:ViewDataBinding/>
</j:beads>

<j:TextInput id="txtInputBinding" text="{texto}"/>

<j:DataGrid id="dg"
width="400"
height="200"
dataProvider="{data}">
<j:columns>
<j:DataGridColumn label="Label" dataField="label" columnWidth="200"/>
<j:DataGridColumn label="Code" dataField="code" columnWidth="200"/>
</j:columns>
</j:DataGrid>
</j:View>



 
image.png