Hello Walter,
Thank you for your reply.
But as I was mentioning, the outer table is not selectable (meaning its
rowSelection="none", which is default).
Only the inner table is selectable.
Hence, when 2nd inner table is selected, I want to be able to clear the
selection of the 1st inner table.
The question becomes how will the inner table row be able to do that via
its 'selectionListener'.
I know the basic mechanism is to use CoreTable that one can extract from
SelectionEvent (as shown below).
But the problem is, the coreTable value that I get for 1st and 2nd inner
table seems to be the same value.
CODE SNIPPETS:
=================
UI code as xhtml;
<tr:table var="outerRow" value="#{mainMB.outerTableRows}"
autoSubmit="true" immediate="true">
<f:facet name="detailStamp">
<tr:table var="innerRow" value="#{outerRow.innerTableRows}"
selectionListener="#{innerRow.innerTableSelectionListener}"
rowSelection="single"
autoSubmit="true"
immediate="true">
<!-- some tr:column definitions -->
</tr:table>
</f:facet>
</tr:table>
The MainMB.java code snippet;
List<OuterTableMB> outerTableRows; // this is initialized somehow
The OuterTableMB.java code snippet
List<InnerTableMB> innerTableRows; // this is initialized somehow and
'this' pointer is passed to them.
The InnerTableMB.java code snippet;
OuterTablesMB outerTableRowPtr = .... // this is set by outer table row
whenever an inner table row is created
CoreTable coreTable = null;
public void innerTableSelectionListener(SelectionEvent _se){
CoreTable __coreTableNew = (CoreTable) _se.getComponent();
if(coreTable == null || (__coreTableNew != null &&
__coreTableNew!=coreTable)) coreTable = __coreTableNew;
// loop over the inner table rows that outer table row had created
for(InnerTableMB __innerTableRow :
outerTableRowPtr.getInnerTableRows()){
if(_innerTableRow != this &&
coreTable!=null)__innerTableRow.unSelectRows();
}
}
public void unSelectRows(){
RowKeySet __selectedRowKeySet = coreTable.getSelectedRowKeys();
__selectedRowKeySet.removeAll();
coreTable.setRowIndex(-1);
}
The problem is, the CoreTable that I extract from SelectionEvent is the
same for both 1st and 2nd inner table.
Regards,
-- ilker
From:
Walter Mourão <[email protected]>
To:
MyFaces Discussion <[email protected]>
Date:
03/04/2010 07:55 AM
Subject:
Re: [Trinidad] Is it possible to unselect row in nested tr:table with
Trinidad 1.2.10 ? Is there a way to get around tr:table using fly-weight
pattern for CoreTable passed in SelectionEvent to selectionListener method
?
Hi Ilker,
Add a selectionListener to the inner table. When the selectionListener is
fired, clear the outer table selection.
Regards,
Walter Mourão
http://waltermourao.com.br
http://arcadian.com.br
http://oriens.com.br
On Thu, Mar 4, 2010 at 9:04 AM, <[email protected]> wrote:
> Hello folks,
>
> I have a nested (via using detailStamp faced) tr:table that is 2 levels
> deep (outer and inner).
> The rows of inner table is single row selectable (via
> rowSelection="single"), while outer table is not selectable.
>
> Let's say I have 2 rows in outer table. Hence, I have 2 inner tables in
> the outer table.
> Let's say these 2 outer rows are expanded and display their inner
tables.
> Then user selects a row in 1st inner table.
> When user selects a row in the 2nd inner table, I'm trying to unselect
the
> row selected in the 1st one.
> But not able to do it.
>
> How can this be done ?
>
> Regards,
> -- ilker
>
> Information Classification: Public
>
> ******************************************************
> IMPORTANT: Any information contained in this communication is intended
for
> the use of the named individual or entity. All information contained in
this
> communication is not intended or construed as an offer, solicitation, or
a
> recommendation to purchase any security. Advice, suggestions or views
> presented in this communication are not necessarily those of Pershing
LLC
> nor do they warrant a complete or accurate statement.
>
> If you are not an intended party to this communication, please notify
the
> sender and delete/destroy any and all copies of this communication.
> Unintended recipients shall not review, reproduce, disseminate nor
disclose
> any information contained in this communication. Pershing LLC reserves
the
> right to monitor and retain all incoming and outgoing communications as
> permitted by applicable law.
>
> Email communications may contain viruses or other defects. Pershing LLC
> does not accept liability nor does it warrant that email communications
are
> virus or defect free.
> ******************************************************
Information Classification: Public
******************************************************
IMPORTANT: Any information contained in this communication is intended for the
use of the named individual or entity. All information contained in this
communication is not intended or construed as an offer, solicitation, or a
recommendation to purchase any security. Advice, suggestions or views presented
in this communication are not necessarily those of Pershing LLC nor do they
warrant a complete or accurate statement.
If you are not an intended party to this communication, please notify the
sender and delete/destroy any and all copies of this communication. Unintended
recipients shall not review, reproduce, disseminate nor disclose any
information contained in this communication. Pershing LLC reserves the right to
monitor and retain all incoming and outgoing communications as permitted by
applicable law.
Email communications may contain viruses or other defects. Pershing LLC does
not accept liability nor does it warrant that email communications are virus or
defect free.
******************************************************