Hello,

Add "table:discard_selected" as partialTarget, tr:table is a naming
container, and I don't think we have a children trigger detection algorithm
implemented yet.

Also, you should not keep a a bound component in session (using binding
attribute). I read that you want to keep the bean session scoped, so you'll
have to split it in two beans:

Bean 1: TableStateBean, session scoped, contains listOfSimpleBeans attribute
Bean 2: TableControllerBean, request scoped, contains a reference to
TableStateBean, component and discardSelectedRowHandler action listener
method. You can inject the state as a managed-property and maybe provide a
getListOfSimpleBeans() method that delegate the call to the tableStateBean
object so you don't have to change the page to reflect that structural
change.


Regards,

~ Simon

On 4/20/07, Edmond B. Mulemangabo <[EMAIL PROTECTED]> wrote:

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/

Reply via email to