Search code examples
vaadinvaadin7

How to add Header Click Listner in Java Vaadin Table?


I am trying to add a very simple listener to my table header as specified in the book of Vaadin. I am using vaadin 6.4.5 in a liferay portlet. But the listener is never called...

table.addListener(new Table.HeaderClickListener() {
            public void headerClick(HeaderClickEvent event) {
                System.out.println("Column header clicked");                
            }
// Disable the default sorting behavior

        });
table.setSortDisabled(true);

I am also unable to add footer to my table like this..

table.setFooterVisible(true);
        table.setColumnFooter("Name", "Average");
        table.setColumnFooter("Died At Age", String.valueOf(avgAge));

Both these code snippets were taken from the book of vaadin but they just don't work in my portlet application. please help


Solution

  • I have working Listener Yeah !

    table.addHeaderClickListener(new HeaderClickListener() {                
            @Override
            public void headerClick(HeaderClickEvent event) {
                 System.out.println("click Header");                
                 Object object= event.getPropertyId();
            }
    });