L-Ray
L-Ray

Reputation: 1647

Expand a Richfaces collapsibleSubTable via javascript

How can I expand a rich:collapsibleSubTable with expandMode="client" via Javascript?

As I understood, the usual way to expand the subTable would be to either use the expanded-attribute

<rich:collapsibleSubTable 
      value="#{list.items}" 
      var="item" 
      expandMode="client" 
      expanded="true">
    <rich:column><h:outputText value="#{item.model}" /></rich:column>
</rich:collapsibleSubTable>

or use the rich:collapsibleSubTableToggler. But because we have the need to open every second sub-table on a datatable, I'm looking for a way to do that via javascript on client-side. Is there a way, to trigger the expand via the javascript RichFaces object or anything? Help appreciated...

Upvotes: 1

Views: 952

Answers (1)

Makhiel
Makhiel

Reputation: 3884

The subTable has collapse() and expand() methods.

If you need to access all subtables you can do it with jQuery:

$('[id$=sbtbl]');

then as you go through the elements, the JS object that represents the table is:

element.rf.component; // element = $('[id$=sbtbl]')[n];

Upvotes: 2

Related Questions