incubator-adffaces-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Edmond B. Mulemangabo" <edmond.mulemang...@uclouvain.be>
Subject Re: how do I refresh a table component after selecting and deleting one or more rows ?
Date Fri, 20 Apr 2007 18:36:59 GMT
Simon Lessard wrote:
> Ok so this is a PPR delete then,

That's correct.

> I assume you placed the delete button on
> each row of the table?

I used "rowSelection" attribute o achieve that. I'm using myFaces +
Trinidad + Facelets; so my script is "xhtml". Here are parts of my
script including the start the table tag and the commandButton that
actually deletes selected rows :

<tr:table
   id="table"
   immediate="true"
   binding="#{backingBean.component}"
   emptyText="#{bundle['empty_text']}"
   rowSelection="multiple"
   allDetailsEnabled="true"
   var="row"
   rows="#{bundle['table_nr_of_rows']}"
   value="#{backingBean.listOfSimpleBeans}"
   rendered="#{!empty ackingBean.listOfSimpleBeans}"
   verticalGridVisible="true"
   horizontalGridVisible="true">
   ...
   <tr:commandButton
       id="discard_selected"
       immediate="true"
       text="#{bundle['button.discard_selected']}"
       shortDesc="#{bundle['tooltip.discard_selected']}"
       actionListener="#{backingBean.discardSelectedRowHandler}"/>
   ...

Here is the method called by the above commandButton using
"actionListener" attribute :

public void discardSelectedRowHandler(ActionEvent action)
{
        UIXTable table = (UIXTable)getComponent();
        Object oldKey = table.getRowKey();
        for (Object rowKey : table.getSelectedRowKeys()) {
            table.setRowKey(rowKey);
            E row = clazzE.cast(table.getRowData());
            row.setChecked(true);
        }
	// remove selected rows from the list
        table.getSelectedRowKeys().removeAll();
        // restore the old key:
        table.setRowKey(oldKey);
}

I tried adding 'partialTriggers="discard_selected"' to "tr:table"; that
didn't solve my problem.

--
Edmond/

Mime
View raw message