Em Mon, 19 Jan 2009 14:27:35 -0300, immutability <devli...@bielik.org> escreveu:

Thiago, thank you for a quick response, I still have a lot to learn!

You're welcome! We all stilee need a lot to learn . . .

One way to do it is to nameColumn.sortable(false) the
the method that returns the BeanModel.
I'm confused at this point. I'm currently not returning the BeanModel
anywhere. When I was using BeanModel to add custom columns, it was a
property that was then bound to the grid component in the .tml file (i.e.
model="model") but since the recent versions of Tapestry5 do not require me to add custom columns using the BeanModel code, I'm not doing this anymore. Hence, my first use of the BeanModel was this - to try and make an existing column sortable (or not-sortable).

Let me put that in other way: regardless of the origin of the BeanModel (created by you or obtained from the Grid instance directly), you should change it in the render request, not in the form submission processing request. You have to understand this distinction to understand Tapestry *and* what is happening to your code. In your case, I think it will be easier to create a BeanModel yourself.

I would try this:

@Inject
private BeanModelSource beanModelSource;

@Inject
private Messages messages;

@Property("flash")
private boolean disableSorting; // this property is set by your form or by any other logic

/* This method will be called during the Grid rendering, and that's exactly what we need here */
public BeanModel getBeanModel() {
BeanModel model = beanModelSource.createDisplayModel(YourClass.class, messages);
        if (disableSorting) {
                PropertyModel nameColumn = 
gridResources.getDataModel().getById("name");
                nameColumn.sortable(false);
        }
        return model;
}

<table t:type="Grid" t:model="beanModel" ...>

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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

Reply via email to