pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: Noobie question about data binding...
Date Thu, 21 Oct 2010 19:47:12 GMT
Glad to hear that you got it working.  :-)

On Oct 21, 2010, at 3:40 PM, Gerrick Bivins wrote:

> Hi Greg,
> I got this to work. The main issue was I wasn't setting things up in the bxml properly.
Here is what I ended up doing:
> 1) define the list in bxml (as you suggested):
>       <bxml:define xmlns:collections="org.apache.pivot.collections">
>          <collections:ArrayList bxml:id="tableDataInList"/>
>      </bxml:define>
> 2) Then in my java code, I have:
>    class SomeWindowWithTable extends Window implements Bindable
>    {
>       ...
>       @BXML private List tableDataInList;
>       ...
>    }
> 
> 3) Any time I want to modify the view in the table:
>     in java:
>        this.tableDataInList.clear(); //clears the table
>     in script:
>        
> <PushButton buttonData="PushButton">
>             <buttonPressListeners>
>             function buttonPressed(button) {
>                 tableDataInList.clear();
>             }
>             </buttonPressListeners>
> 
>         </PushButton>
> I was confused about what was needed to be defined and where.
> 
> Works like a champ now!
> Thanks for the patience!
> Gerrick
> On Thu, Oct 21, 2010 at 11:59 AM, Greg Brown <gkbrown@mac.com> wrote:
> Can you try running the attached example and let me know what happens when you click
the button? Easiest way to launch it is via the Eclipse plugin, which you can get here:
> 
> http://cwiki.apache.org/confluence/download/attachments/108483/org.apache.pivot.eclipse_2.0.0.jar
> 
> If you don't use Eclipse you can launch it via ScriptApplication directly. Let me know
if you need any help with that.
> 
> G
> 
> 
> 
> On Oct 21, 2010, at 11:01 AM, Gerrick Bivins wrote:
> 
>> Hi Greg,lello,
>> 
>> I'm not seeing this behavior. What I'm seeing is that the list needs to be populated
before calling the namespace.put() in the serializer and then
>> it doesn't update/reflect any changes to the list after that.
>> Gerrick
>> 
>> On Thu, Oct 21, 2010 at 6:23 AM, Greg Brown <gkbrown@mac.com> wrote:
>> > In your example what happens when you change the ArrayList tableDataInList?
>> > is the change automatically fired in the table? or do I need a listener?
>> 
>> Yes, ArrayList fires change events when its content is modified, so the table will
automatically update in response.
>> 
>> 
> 
> 
> 


Mime
View raw message