You can take a look at
http://tapestry.1045711.n5.nabble.com/Grid-sortable-additionnal-column-td2433091.html.

On .tml file, you need to use beanModel attribute on the Grid component:
<t:grid t:source="transactionList" row="transaction"
t:model="beanModel" >

On .java file, you need to add your "amount" property to the beanModel:
    @Inject
    private BeanModelSource beanModelSource;

    @Inject
    private Messages messages;

    private BeanModel beanModel;

    public BeanModel getBeanModel() {
        return beanModel;
    }

    void setupRender() {
       beanModel = beanModelSource.createEditModel(<your bean class>,
messages);
       beanModel.add("<your user type property name>", <propertyConduit>);
    }

If your user type implements Comparable, then your property will be
displayed as sortable column.

Best regards,
Yohan Yudanara


On 1/9/11, Gunnar Eketrapp <gunnar.eketr...@gmail.com> wrote:
> Hi Thiago and others ...
>
> I still haven't managed to display and sort user types in the grid. If
> I do the cell rendering on my own as in ...
>
>             <p:amountCell>
>                 ${transaction.amount.format()}
>             </p:amountCell>
>
> .. the sorting goes away ....
>
> I have added a MoneyTranslator but that one is only used by forms I guess.
>
> Your last advice was ...
>
>>  You can also provide a view block for your own types:
>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>> Property Editors. This option is better suited when you use the same
>> property types in many grids. If it's just one, a >  cell override is the
>> best option.
>
> ... which I have read but dont understand how to use. (To stupid I guess
> ...)
>
> Do you mean that I by adding a property editor for my Money class I
> will be able to display and sort my money type in grid's.
>
> Thanks in advance !!!
> Gunnar Eketrapp,
>
> 2010/12/17 Thiago H. de Paula Figueiredo <thiag...@gmail.com>:
>> On Fri, 17 Dec 2010 12:42:14 -0200, Stephan Windmüller
>> <stephan.windmuel...@tu-dortmund.de> wrote:
>>
>>> You have to define the layout of the cell by yourself. Have a look at
>>>
>>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry5/corelib/components/Grid.html
>>
>> You can also provide a view block for your own types:
>> http://tapestry.apache.org/beaneditform-guide.html, section Adding New
>> Property Editors. This option is better suited when you use the same
>> property types in many grids. If it's just one, a cell override is the
>> best
>> option.
>>
>> --
>> Thiago H. de Paula Figueiredo
>> Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
>> and
>> instructor
>> Owner, Ars Machina Tecnologia da Informação Ltda.
>> http://www.arsmachina.com.br
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>
>
>
> --
> [Hem: 08-715 59 57, Mobil: 0708-52 62 90]
> Allévägen 2A, 132 42 Saltsjö-Boo
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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

Reply via email to