Details
-
Type: Bug
-
Status: Closed
-
Priority: Critical
-
Resolution: Incomplete
-
Affects Version/s: 1.5.1
-
Fix Version/s: 1.6DR#3
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Operating System: Windows XP
Platform: PC
-
Assignee Priority:P1
-
Support Case References:
Description
outlines the problem.
The table is rendering fine the first time, but on subsequent renderings, the
columns all have the same content. Upon testing, the submitter of the post
found that columnDataModel.getRowIndex() was returning 0 each time after the
first render.
I did some testing on my machine with an older version of ColumnsBean in the
Component Showcase. I found that not changing the columnDataModel recreated
the problem.
The problem is not evident in the current form of the Columns demo because the
content is the same in each column. However, using Rev. 11545 of ColumnsBean
will give you dynamic cell content in different columns. In this version of
ColumnsBean, the columnDataModel changes each time as the header String is
modified to reflect the new range of values in the column. When you make the
content of the columnDataModel static, (the same headers all the time) you
will see the first column repeated across all the columns.
-
- Example3.java
- 2 kB
- dukehoops
-
- Example3.java
- 1 kB
- adnan_d
-
Hide
- columns-facelets.war
- 4.99 MB
- adnan_d
-
- META-INF/MANIFEST.MF 0.1 kB
- META-INF/context.xml 2 kB
- WEB-INF/classes/test/Example1.class 1 kB
- WEB-INF/classes/test/Example1.java 0.7 kB
- WEB-INF/classes/test/Example2.class 2 kB
- WEB-INF/classes/test/Example2.java 2 kB
- WEB-INF/classes/test/Example3.class 2 kB
- WEB-INF/classes/test/Example3.java 1.0 kB
- WEB-INF/classes/test/Example4.class 3 kB
- WEB-INF/classes/test/Example4.java 3 kB
- WEB-INF/faces-config-facelet.xml 2 kB
- WEB-INF/faces-config.xml 1 kB
- WEB-INF/lib/backport-util-concurrent.jar 343 kB
- WEB-INF/lib/commons-beanutils.jar 184 kB
- WEB-INF/lib/commons-collections.jar 546 kB
- WEB-INF/lib/commons-digester.jar 107 kB
- WEB-INF/lib/commons-discovery.jar 70 kB
- WEB-INF/lib/commons-el.jar 110 kB
- WEB-INF/lib/commons-fileupload.jar 22 kB
- WEB-INF/lib/commons-logging.jar 37 kB
- WEB-INF/lib/el-api.jar 24 kB
- WEB-INF/lib/el-ri.jar 97 kB
- WEB-INF/lib/icefaces-comps.jar 593 kB
- WEB-INF/lib/icefaces-facelets.jar 574 kB
- WEB-INF/lib/icefaces.jar 628 kB
- WEB-INF/lib/jsf-api.jar 356 kB
- WEB-INF/lib/jsf-impl.jar 778 kB
- WEB-INF/lib/jstl.jar 17 kB
- WEB-INF/.../krysalis-jCharts-1.0.0-alpha-1.jar 151 kB
- WEB-INF/lib/xercesImpl.jar 987 kB
-
- columns.xhtml
- 2 kB
- dukehoops
-
Hide
- columns.war
- 4.59 MB
- adnan_d
-
- META-INF/MANIFEST.MF 0.1 kB
- META-INF/context.xml 2 kB
- WEB-INF/classes/.../AddressBean.class 1 kB
- WEB-INF/classes/.../address/AddressBean.java 3 kB
- WEB-INF/.../AddressFormProcessor.class 14 kB
- WEB-INF/.../AddressFormProcessor.java 31 kB
- WEB-INF/classes/.../FormElement.class 1 kB
- WEB-INF/classes/.../address/FormElement.java 4 kB
- WEB-INF/.../FormElementContainer.class 4 kB
- WEB-INF/.../FormElementContainer.java 6 kB
- WEB-INF/classes/.../LinkedFormElement.class 2 kB
- WEB-INF/classes/.../LinkedFormElement.java 6 kB
- WEB-INF/classes/.../MatchAddressDB.class 5 kB
- WEB-INF/classes/.../MatchAddressDB.java 9 kB
- WEB-INF/classes/.../address/MatchBean.class 1 kB
- WEB-INF/classes/.../address/MatchBean.java 3 kB
- WEB-INF/classes/.../address/MatchCity.class 2 kB
- WEB-INF/classes/.../address/MatchCity.java 4 kB
- WEB-INF/classes/.../address/MatchState.class 3 kB
- WEB-INF/classes/.../address/MatchState.java 4 kB
- WEB-INF/classes/.../address/MatchZip.class 0.6 kB
- WEB-INF/classes/.../address/MatchZip.java 2 kB
- WEB-INF/classes/.../address/Matchable.class 2 kB
- WEB-INF/classes/.../address/Matchable.java 7 kB
- WEB-INF/classes/.../address/PhaseSync.class 2 kB
- WEB-INF/classes/.../address/PhaseSync.java 3 kB
- WEB-INF/classes/.../address/ReadmeBean.class 2 kB
- WEB-INF/classes/.../address/ReadmeBean.java 4 kB
- WEB-INF/classes/.../SubmitButton.class 0.9 kB
- WEB-INF/classes/.../SubmitButton.java 3 kB
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
I have read through the forum posting, and created some examples which manifests application of ice:columns component including the one mentioned on the following forum by Kepatronik:
http://www.icefaces.org/JForum/posts/list/3284.page
I never found any problem of rowIndex with ice:columns component. I simulated the same test as kepatronik was mentioned and it is working very well.
The application of ice:columns component is not as straigh forward as other components which creates confusion among developers. The ice:columns could be used for many different scenarios.
First of all here is the default rendering of ice:columns component, which is not useful in this case (e.g.)
- The "value" attribute of "dataTable" binds with the rowModel that represents rows of the table and each row is combination of both "column" or "columns" component.
- The "value" attribute of "columns" component represents the columnModel, which renders each row of its model vertically as column. Sounds a bit confusing, let see in action(e.g.)
bean code snippt:
Strin[] rowModel =
String[] columnsModel =
{"col1", "col2", "col3"}jspx:
<ice:dataTable value="#
" var="row"/>
&ice:column>
<ice:outputText value="#
" />
</ice:column>
&ice:columns value="#
{bea.columnsModel}" var="column" >
<ice:outputText value="#
" />
</ice:columns>
</ice:dataTable>
rendered result:
row1 col1 col2 col3
row2 col1 col2 col3
row3 col1 col2 col3
As it can be seen above that it is not useful to have same column for each row, so when it would be useful? how about crossJoin? (e.g.)
Task: Write a javascript events support among different browsers.
String[] events=
{"onclcik", "onkeyup", "ondrag"}String[] browsers =
{"IE", "Firefox", "Safari"}DataModel rowModel = new ArrayDataModel(events);
DataModel columnsModel = new ArrayDataModel(browsers);
Map<String, String> eventSupport = new HashMap<String, String>();
.....
//Assume ondrag event is not supported by Safari
for (String event: events) {
for (String browser: browsers)
}
.......
.......
public Object getCellValue(){
DataModel rowDataModel = getRowModel();
if (rowDataModel.isRowAvailable())
{
Object event = getRowModel().getRowData();
DataModel columnsDataModel = getColumnsModel();
if (columnsDataModel.isRowAvailable())
}
return null;
}
.......
JSPX:
<ice:dataTable value="#
{bean.rowModel}"
var="event" >
<ice:column>
<ice:outputText value="#
" style="font-weight: bold;"/>
</ice:column>
<ice:columns value="#
{bean.columnsModel}" var="broswer">
<f:facet name="header">
<h:outputText value="#
" />
</f:facet>
<ice:outputText value="#
" style="color:#
{bean.cellValue eq 'true'?'green':'red'};"/>
</ice:columns>
</ice:dataTable>
Rendered output
IE Firefox Safari
onclcik true true true
onkeyup true true true
ondrag true true false
Here is the same version of demo with facelets, as I never used "header" facet inside the ice:columns, so this would only work with ICEFaces version >=1.6DR#1. If you want to run this demo with earlier version of ICEFaces then please add "header" facet inside the ice:column component.
I tried your example3 and as you've provided it, it did produce desired results. However the fact that you're incrementing an index in the getter of a property that's to be displayed produces these problems:
1. add another button to the same page (but in a different form). This button is NOT supposed to alter state of data table. click it. dataTable pages forward (because ++ is executed during RENDER_RESPONSE). This means one cannot have other links/buttons or failing validation in the same page as dataTable. (which is quite unrealistic).
2. cannot use this with session-scoped beans (and refresh page) - will advance dataTable forward because ++ will execute again.
I'd augmented Example3 to fix the above and am posting it here. Search code for "NIKITA" to see the changes made. (Attaching Example3.java and columns.xhtml)
-nikita
http://themusiclounge.com
While I was writing this demo I never thought of multi buttons scenario, however again it is application problem not the component. I have re-factored the demo version to support multi buttons and change dataTable only if associated button was clicked.
what happens if, in example3 it is desired to print 'support info' twice for each cell? ie replace:
<ice:outputText value="#
{example3.suportInfo}"/>with:
<ice:outputText value="#{example3.suportInfo}
_#
{example3.suportInfo}"/>
?
Well, getSuportInfo() will be executed 2x per cell, and - because suportInfo is being incremented in the getter, instead of seeing "1_1" in a given cell, you'll see "1_2".
Do you deem this an "application problem" as well? Should the client developer really change the way cell coordinates are computed depending on what is rendered inside this cell, or what other forms are present on the same page?
What works better is this:
(in getSuportInfo()):
DataModel rowModel = this.getRowModel();
DataModel colModel = this.getColumnsModel();
int rIdx = rowModel.getRowIndex();
int cIdx = colModel.getRowIndex();
int pageOffset = rIdx*colModel.getRowCount() + cIdx;
return suportInfo + pageOffset;
-nikita
So did you get problem fixed??
All attached demo were made to manifest that there isn't any bug or problem with the component itself. It is what requirements are and how developer designs it.
As you found my design not to be promising enough for the scenario you mentioned, but you have right way to do it.
In short, no it didn't. Two problems:
1. if a page contains two <ice:columns> tags on render I get the following error message:
Mar 26, 2007 1:53:47 PM com.icesoft.faces.facelets.D2DFaceletViewHandler verifyUniqueComponentIds
SEVERE: Multiple UIComponents found, which are wrongfully using the same id: -10. Most recent UIComponent: com.icesoft.faces.component.ext.UIColumns@a16b7c
Mar 26, 2007 1:53:56 PM com.icesoft.faces.facelets.D2DFaceletViewHandler verifyUniqueComponentIds
2. after some navigating to/from page (and/or doing page refresh) I can get the page into a state where a given row in dataTable has same value in every cell. This seems to happen because columnDataModel.getRowIndex() starts always returning '0's. At this point I cannot figure out a nav/refresh pattern that triggers this condition.
Could #1 be causing this? Where in icefaces source should I look to see what affects DataModel.getRowIndex()? I've been looking through UIColumns.java and UISeries.java w/o any success.
I have a repro if one is needed