Question

OK, I am using GWTP. I used eClipse to create TestPresenter.

In TestView.ui.xml, i have

<g:HTMLPanel>
    <g:FlexTable ui:field="messageFlexTable" borderWidth="1" /> </g:HTMLPanel>

In TestPresenter.java, i have

Button clearButton=new Button("Clear");
    getView().getComposeMessageHTMLPanel().add(clearButton);

    clearButton.addClickHandler(new ClickHandler(){

        @Override
        public void onClick(ClickEvent event) {
            // TODO Auto-generated method stub
            getView().getMessageFlexTable().clear();
        }

    });

But when clicking clear only buttons & labels inside that flextable got cleared, all the text & border of that flextable are still there?

However, If i create FlexTable via code FlexTable ft=new FlexTable(); then i have no problem?

What wrong? Is it a bug in GWTP?

Was it helpful?

Solution

FlexTable extends HTMLTable. As per javadoc for HTMLTable method clear()

Removes all widgets from this table, but does not remove other HTML or text contents of cells.

If you really need to remove all table rows from it use removeAllRows() instead. See HTMLTable#clear() and FlexTable#removeAllRows()

Note: for better performance you could also consider using Grid instead if you do not need any particular features of FlexTable like dynamic size or colspan/rowspan.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top