You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by jupraman <ma...@jupra.com> on 2012/08/29 00:32:47 UTC

grid in zone gets pre-selected value from select component

Hello,

Fairly new to Tapestry. Using version 5.3.4. I'm having a strange (to me
anyway) behavior using a select component to update a grid via ajax. The
grid is updated just fine except that my index.java class reads the previous
value from the select component, not the one I just selected.

In my tml I have:

<t:zone t:id="billetZone" id="billetZone">
    <t:grid source="billetList" row="billet" rowsPerPage="billetPagerSize"
inPlace="true" add="view" reorder="view">
        <p:viewCell>
            <t:actionlink t:id="viewBillet" context="billet.id"
zone="viewBilletZone">View</t:actionlink>
        </p:viewCell>
    </t:grid>
</t:zone>

<t:zone t:id="filterZone" id="filterZone">
<t:form>

    
Filters
    

        <t:label t:for="brBilletTypeFilter">Type:</t:label>
        <t:select t:id="brBilletTypeFilter"
                     model="brBilletTypeModel"
                     encoder="brBilletTypeEncoder"
                     zone="billetZone"/>
    

</t:form>
</t:zone>

my java:

@Persist
private BRBilletType brBilletTypeFilter;

public Object onValueChangedFromBrBilletTypeFilter(){
    if(brBilletTypeFilter == null){
        billetList = session.createCriteria(BRBillet.class).list();
    }
    else {
        brBilletTypeFilter = (BRBilletType)session.load(BRBilletType.class,
brBilletTypeFilter.getId());
        billetList.clear();
        billetList.addAll(brBilletTypeFilter.getBillets());
    }
    return billetZone.getBody();
}
 
Haven't found a post with a similar problem, only stuff that deals with
setting the value of the select.
Firebug shows my last selection as "selected" but my grid will always be
loaded using the value that is
currently selected, not the value I just selected. I have select and option
models, and an encoder for the 'brBilletTypeFilter'. 

Thanks for any insight into this problem.
--Mark 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/grid-in-zone-gets-pre-selected-value-from-select-component-tp5715860.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: grid in zone gets pre-selected value from select component

Posted by jupraman <ma...@jupra.com>.
Found the problem in my code:

Select component generates onChange when zone parameter is bound. This is
different from a form submit event. so changing my onChange method to this
solved my problem:

public Object onValueChangedFromBrBilletTypeFilter(BRBilletType
brBilletTypeFilter){   <---- included value passed in from select
    this.brBilletTypeFilter = brBilletTypeFilter;   <---- updated value for
select component.


I know this is beginner level, but hopefully it will help someone.

--



--
View this message in context: http://tapestry.1045711.n5.nabble.com/grid-in-zone-gets-pre-selected-value-from-select-component-tp5715860p5715889.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: grid in zone gets pre-selected value from select component

Posted by jupraman <ma...@jupra.com>.
Actually looking at the way I worded my problem, this may clarify some:

When I select a value from the select component and the 'onValueChanged' is
triggered, the first value is always null. Subsequent selections will always
return the prior value from the select. So if I had select with the values
1,2,3,4... when I select 3 I get null, when I select 4 I get 3 and when I
select 2 I get 4. Always the previous value.

Must be missing something obvious here but I don't know what. 



--
View this message in context: http://tapestry.1045711.n5.nabble.com/grid-in-zone-gets-pre-selected-value-from-select-component-tp5715860p5715888.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org