Is there a way to perform an action in a rowToggler?

UI Components for JSF
Post Reply
inxsible
Posts: 53
Joined: 07 Dec 2010, 21:30

16 Dec 2010, 18:12

I want to get some additional data when user clicks on the rowToggler, because the dataset could be large and I don't want to get it in one go.

I want the datatable to display rows and then depending on which row (or rowToggler) is clicked, I want to get the child data for that row.

Is this possible in a rowToggler? or would I just have to make it a commandLink and then perform the action?
PF-2.2.1 || Mojarra 2.0.3-FCS || Eclipse 3.6.1 (Helios) || Weblogic 11gR1

callahan
Posts: 768
Joined: 27 May 2010, 22:52

16 Dec 2010, 21:38

It should be possible to achieve this. The data displayed when a rowToggler opens a row is lazily loaded. This can see this with Firebug. For example, car.manufacturer and car.color are only displayed when a row is expanded is this example:
http://www.primefaces.org/showcase/ui/d ... leRows.jsf. I'd imagine that this means that car.manufacturer and car.color could be lazily loaded.

inxsible
Posts: 53
Joined: 07 Dec 2010, 21:30

16 Dec 2010, 21:50

how would you know in the bean, as to which row was selected, so that I can use the correct attributes to get the data for that row?
PF-2.2.1 || Mojarra 2.0.3-FCS || Eclipse 3.6.1 (Helios) || Weblogic 11gR1

callahan
Posts: 768
Joined: 27 May 2010, 22:52

16 Dec 2010, 22:06

I don't think you have to know. In the showcase example, the Car methods getManufacturer and getColor will only be called when the row is expanded (I think, I haven't tried it). This means that the could simply load their data lazily when called.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

17 Dec 2010, 12:31

We can add rowToggleListener="#{bean.method}" like we have for row editing (row edit listener). Feel free to create a feature request.

inxsible
Posts: 53
Joined: 07 Dec 2010, 21:30

17 Dec 2010, 17:08

I will. But I think this will also help with the "subtable" feature request since I can see a use case, where the parent data row has so many children data rows, that getting them all at once might be slow. So we get the parent data and then "onclick" of the rowToggler, get the children data for that row and that row only.

Do you think I should put it as an addon to the subtable request or create a new one altogether?
PF-2.2.1 || Mojarra 2.0.3-FCS || Eclipse 3.6.1 (Helios) || Weblogic 11gR1

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

17 Dec 2010, 17:14

I think there is already a request on subtable.

inxsible
Posts: 53
Joined: 07 Dec 2010, 21:30

17 Dec 2010, 17:20

you are right. I will just create the one for a rowTogglerListener.

Thanks again Cagatay.
PF-2.2.1 || Mojarra 2.0.3-FCS || Eclipse 3.6.1 (Helios) || Weblogic 11gR1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests