-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
I am trying to loop through database results and render a grid that has grouping on a page. The group label should be a term and the group rows should display all the possible uses of this term. The possible uses of a term are stored as pipe delimited text in the database. This is my Java code:
public void populateGlossary() {
Rows rows = new Rows();
glossary.appendChild(rows);
Group cGrp = new Group("GlossaryTerm1:");
cGrp.setVisible(true);
cGrp.setOpen(true);
glossary.getRows().appendChild(cGrp);
Row cRow = new Row();
cRow.appendChild(new Label(""));
cRow.appendChild(new Label("Explanation of term1"));
glossary.getRows().appendChild(cRow);
List glossaryResults = executeNamedQuery("getGlossary", null, null);
for (int i=0; i < glossaryResults.size(); i++) {
Object[] dataObj = (Object[]) glossaryResults.get(i);
Group grp = new Group(dataObj[0].toString());
grp.setVisible(true);
grp.setOpen(true);
glossary.getRows().appendChild(grp);
String[] codeUses = dataObj[1].toString().split("\\|");
for (int j=0;j<codeUses.length;j++) {
Row row = new Row();
row.appendChild(new Label(""));
row.appendChild(new Label(codeUses[j].toString()));
glossary.getRows().appendChild(row);
}
}
}
My jsp page is: <z:grid id="glossary" mold="paging" pagesize="50" pagingposition="both" emptymessage="There is currently no glossary available."> <z:columns sizable="true"> <z:column label="Code" width="30%"/> <z:column label="Code Use" width="70%" align="left"/> </z:columns> </z:grid>
The grid displays fine...but there is no Expand/Collapse button next to the Group Label. The Group looks like a row. What I am doing wrong?
Thank you for your time.
Regards, Jyothi
Any chance to use master-detail feature?
Asked: 2013-04-03 04:45:56 +0800
Seen: 38 times
Last updated: Apr 03 '13
composite component help [closed]
EL in a forEach @command not working?
Different template for each grid row
Cardlayout animation is broken
Grid RowRender slow using 6.5.1 and sizable=true
setVisible(false), component will load or not
Decimalbox and doublebox value rounded on iPad
history management with page status
Thank you Steva77. Master Detail when implemented in Java needs OnOpen Event to create detail components, right? I was looking for some simpler implementation of hide/show detail. Can Grouping be implemented in Java?
Thanks again!
jmyneni ( 2013-04-03 13:52:05 +0800 )editActually, I never implemented the master-detail feature programmatically, but I assume is rather similar to your iterative approach, unless you want to create the detail component on the fly when you fire the OnOpenEvent...
No ready-to-use solution, sorry...
Steva77 ( 2013-04-03 14:31:00 +0800 )edit