Creator Tip: How to create a Collapsible Group Table?

Another interesting feature of the Sun Java Studio Creator Table component, which many users might not be aware of, is the ability to collapse the Table Row Group. Interestingly the collapsing does not involve round trip to the server, so it is fast and convenient. I've created a small project for this tip which you can download from here.

Steps:

  • Add a Table Component to the design surface
  • Drag and drop a Table Row Group (child of Table in the palette) on to the Table Component
    Now you should see two groups of table rows in the table (see picture below)
  • Drag and drop the Person table from Servers Tab  (Data Sources -> Travel -> Tables -> Person on to the first Table Row Group
    Make sure the first Table Row group is highlighted to accept the drop, not the Table. A dialog pops up to ask if the drop should go to the table1 or tableRowgroup1. Select  tableRowgroup1
  • Drag and drop the Trip table from Servers Tab  (Data Sources -> Travel -> Tables -> Trip on to the second Table Row Group.
    Make sure the second Table Row group is highlighted to accept the drop. A dialog pops up to ask if the drop should go to the table1 or tableRowgroup2. Select  tableRowgroup2
  • Select tableRowgroup1 from Outline window and in the property sheet, enter the text"Person Row Group" to the property headerText and select the checkbox for the property groupToggleButton.
  • Similarly, select tableRowgroup2 from Outline window and in the property sheet, enter the text  "Trip Row Group" to the property headerText and select the checkbox for the property groupToggleButton.
  • Select and right click on tableRowgroup1 from Outline window and select Table Layout menu item. In the options panel of the dialog select pagination checkbox and set number of rows to 3.
  • Similarly, select and right click on tableRowgroup2 from Outline window and select TableLayout menu item. In the options panel of the dialog select pagination checkbox and set number of rows to 7.

Deploy and the page in the browser would look like the image below.

Now click on the down arrow in the Trip Row group, you would see the row group collapsing immediately as shown in the image below.

Comments:

not sure if this makes sense or would even be useful in production (a bit confusing and an non-familiar GUI approachif you ask me), but does really show the power of Creator and the components made by Sun. Now, if we could only get that to continue along with work on the IDE itself. I would love to see even more available from the table or drop down components.

Posted by jjones on October 24, 2006 at 07:57 AM PDT #

Hi, this is really nice. I've a question: the second table con be filtered on the personid that is selected on the first table ? Thanks mickgiu

Posted by mickgiu on October 24, 2006 at 05:04 PM PDT #

Why is it I can't make the row count to 10? I have 3 tablerowgroups, and if I set all the row count to 10, even if I have more than 10 rows per each tablerowgroup, the pagination is not displayed? It only accepts up to 8? The user should have an option to put in there his defined number of rows then just divide it to the total number of rows in the tableprovider and that should be the pagination setting. I'm I missing something here?

Posted by sirkware on November 08, 2006 at 03:32 PM PST #

This is some what an experimental feature, we are not sure if our users would really want such features. If it is really liked by our users we are willing to spent time to enhance this feature.

Mickgiu, after selecting the personid, if the page is submitted, then it may be possible to filter the second rowgroup. But I haven't tried it though.

Sirkware, looks like it is a bug, it should continue to display the rows in the rowgroups which still have data, and empty for the rowgroups that do not have any data. I will bring this up with the component team.

Posted by Winston Prakash on November 10, 2006 at 12:44 AM PST #

Messed around with this today. It's pretty cool. Now how to get the rowgroup to maintain state between requests? Also I guess the collapsed / uncollapsed icons could change to show which state the table is in... Anyway thanks for the tip. We'll see what feedback I get from my end users.

Posted by yossarian on November 28, 2006 at 01:51 AM PST #

I have a case when this would be useful. A few comments about it though which would be nice if it could be improved on: 1. When you expand the group - the row headers appear above the group name. These feels wrong - they should appear below the group name. 2. Would be nice to have the option to "augment" the group headings in the same way you can the Table title. i.e. show the number of rows in each group. 3. The paging didn't work how I expected, i.e. paging through both groups at the same time, but then again - I'm not sure how this could be done better.

Posted by IBeaumont on January 21, 2007 at 06:28 PM PST #

It's similar to Sourceforge file download pages and I found it very useful. We are using it to show financial products of different type to our users, allowing them to hide unneeded items.

Posted by Daniele on June 05, 2007 at 05:36 AM PDT #

Hi Winston, Is this collabsible table possible using eclipse 3.1, JSF 1.0.1 RI and Jboss 4.0.2? What implementation of JSF have you used here? I need to develop a similar component, some more technical information would be very helpful.

Posted by Dilip on July 23, 2007 at 01:41 PM PDT #

This blog is really informative regarding Creator.I am facing a problem of rendering a creator table in weblogic.I have used all the tricks provided over here.I am using ObjectListDataProvider,in my case no error occurs but the table is not rendered with data. The dataprovider has data at the time of rendering.Kindly help me out....

Posted by Vijay on August 05, 2007 at 08:46 PM PDT #

Hi Winston!!! I don't find examples about TableDataFilter's. I need to filter table component rows by some criterias. How I can do it? Please, if this question has been resolved, tell me a link to that solution. Thanks!!!

Posted by Santiago on October 10, 2007 at 09:57 PM PDT #

I'd like you to send me all the used in exmample libraries - if it's possible. Or show me the links where I can find them.

Posted by valiantsin on November 20, 2007 at 11:27 PM PST #

Hi,

Can anyone help.

I have table with Pagination.

I know there is method tablegrowgroup.getPage(). But how I can say in code that I want to go to Page 2 or 3. I have a situation where the user comes in the page and the table must be opened in page x. There is now method like setPage()

Posted by J on December 11, 2007 at 03:38 PM PST #

Hi,
1) I made use of "List<Names> myList;" variable in my Page and used this variable to table, by making use of table layout .
2) Also dropdown1 which contains firstnames which is a variable in Names class, but now i want my table to work like this . when i select dropdown1 ,depending on selected value a row should be created in a table with manually assigned valus (bcoz value comes from xml parser).
please can any one tell me how to solve this problem or even give me some hint to solve.

Posted by jaysonkn on October 12, 2008 at 09:37 PM PDT #

Hi, Thanks for nice article. Can the second table con be filtered on the person_id that is selected on the first table ?

Posted by ashish on July 25, 2010 at 11:12 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today