You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Vladimir Bauer <VB...@slb.com> on 2012/01/31 13:26:11 UTC
exclude a column from a grid component, by a condition
Good day everybody!
I need to exclude a column from a grid component, by a condition.
t:exclude parameter of a grid component provides ability to exclude any column, but with no condition.
So far I have following code, but I think it is a bit ugly, because it is repeating same line with grid.
<t:if test="excludeCondition">
<t:grid t:source="reports" t:row="evntRow" t:exclude="somecolumn" />
<p:else>
<t:grid t:source="reports" t:row="evntRow" />
</p:else>
</t:if>
Any idea how to do it more properly?
Regards,
Vladimir Bauer
Re: exclude a column from a grid component, by a condition
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
Better yet: provide your own BeanModel to the Grid (model parameter).
Something like this:
@Inject
private BeanModelSource beanModelSource;
public BeanModel getBeanModel() {
BeanModel<YourClass> =
beanModelSource.createDisplayModel(YourClass.class);
if (...) {
beanModel.exclude("propertyToBeExcluded");
}
}
<table t:type="Grid" ... t:model="beanModel">
On Tue, 31 Jan 2012 11:07:25 -0200, Dusko Jovanovski <du...@gmail.com>
wrote:
> Try this:
>
> .tml:
>
> <t:grid t:source="reports" t:row="evntRow" t:exclude="${excludeColumn}"
> />
>
> .java:
>
> public String getExcludeColumn(){
> if(excludeCondition)
> return "somecolumn";
> else return null;
> }
>
> I didn't test this code, but it should work.
>
> 2012/1/31 Vladimir Bauer <VB...@slb.com>
>
>> Good day everybody!
>>
>> I need to exclude a column from a grid component, by a condition.
>> t:exclude parameter of a grid component provides ability to exclude any
>> column, but with no condition.
>>
>> So far I have following code, but I think it is a bit ugly, because it
>> is
>> repeating same line with grid.
>>
>> <t:if test="excludeCondition">
>> <t:grid t:source="reports" t:row="evntRow"
>> t:exclude="somecolumn" />
>>
>> <p:else>
>> <t:grid t:source="reports" t:row="evntRow" />
>> </p:else>
>>
>> </t:if>
>>
>> Any idea how to do it more properly?
>>
>> Regards,
>> Vladimir Bauer
>>
>>
>>
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
Consultor, desenvolvedor e instrutor em Java, Tapestry e Hibernate
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: exclude a column from a grid component, by a condition
Posted by Vladimir Bauer <VB...@slb.com>.
Thanks, Dusko!
This approach works!
Dusko Jovanovski <du...@gmail.com> написал:
Try this:
.tml:
<t:grid t:source="reports" t:row="evntRow" t:exclude="${excludeColumn}" />
.java:
public String getExcludeColumn(){
if(excludeCondition)
return "somecolumn";
else return null;
}
I didn't test this code, but it should work.
2012/1/31 Vladimir Bauer <VB...@slb.com>
> Good day everybody!
>
> I need to exclude a column from a grid component, by a condition.
> t:exclude parameter of a grid component provides ability to exclude any
> column, but with no condition.
>
> So far I have following code, but I think it is a bit ugly, because it is
> repeating same line with grid.
>
> <t:if test="excludeCondition">
> <t:grid t:source="reports" t:row="evntRow"
> t:exclude="somecolumn" />
>
> <p:else>
> <t:grid t:source="reports" t:row="evntRow" />
> </p:else>
>
> </t:if>
>
> Any idea how to do it more properly?
>
> Regards,
> Vladimir Bauer
>
>
>
Re: exclude a column from a grid component, by a condition
Posted by Dusko Jovanovski <du...@gmail.com>.
Try this:
.tml:
<t:grid t:source="reports" t:row="evntRow" t:exclude="${excludeColumn}" />
.java:
public String getExcludeColumn(){
if(excludeCondition)
return "somecolumn";
else return null;
}
I didn't test this code, but it should work.
2012/1/31 Vladimir Bauer <VB...@slb.com>
> Good day everybody!
>
> I need to exclude a column from a grid component, by a condition.
> t:exclude parameter of a grid component provides ability to exclude any
> column, but with no condition.
>
> So far I have following code, but I think it is a bit ugly, because it is
> repeating same line with grid.
>
> <t:if test="excludeCondition">
> <t:grid t:source="reports" t:row="evntRow"
> t:exclude="somecolumn" />
>
> <p:else>
> <t:grid t:source="reports" t:row="evntRow" />
> </p:else>
>
> </t:if>
>
> Any idea how to do it more properly?
>
> Regards,
> Vladimir Bauer
>
>
>