« Return to Thread: Grid / sortable additionnal column

Re: Grid / sortable additionnal column

by Thiago H. de Paula Figueiredo :: Rate this Message:

Reply to Author | View in Thread

On Wed, Jul 1, 2009 at 8:39 AM, Francois Malet<francois_malet@...> wrote:
> Hello,

Hi!

>            PropertyModel dModel= beanModel.add("download",null);

The problem is here: Grid doesn't know how to get the download
property (column) value to sort it, as you passed a null
PropertyConduit to the add() method.
You need to implement a PropertyConduit for and pass it to the add()
method. If Upload implements sortable, you don't need to
dModel.sortable(true);.

Here's one example for a PropertyConduit related to the manager
property (which is of type User) of the Project class:

public class ProjectManagerPropertyConduit implements PropertyConduit {

        public <T extends Annotation> T getAnnotation(Class<T> annotationClass) {
                return null;
        }

        /**
         * @see org.apache.tapestry5.PropertyConduit#get(java.lang.Object)
         */
        public Object get(Object instance) {
                Project project = (Project) instance;
                return project.getManager();
        }

        @SuppressWarnings("unchecked")
        public Class getPropertyType() {
                return User.class;
        }

        public void set(Object instance, Object value) {

                Project project = (Project) instance;
                project.setManager((User) value);

        }

}


--
Thiago

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

 « Return to Thread: Grid / sortable additionnal column