[richfaces-issues] [JBoss JIRA] (RF-13095) extendedDataTable tableState setter not called on column resize/reorder
Brian Leathem (JIRA)
jira-events at lists.jboss.org
Sat Aug 24 23:24:26 EDT 2013
[ https://issues.jboss.org/browse/RF-13095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798975#comment-12798975 ]
Brian Leathem edited comment on RF-13095 at 8/24/13 11:23 PM:
--------------------------------------------------------------
As requested in https://issues.jboss.org/browse/RF-13126 - The following defines the table with tableState:
{code}
<rich:extendedDataTable
id="contTable"
var="b"
value="#{appController.dataModel}"
enableContextMenu="false"
frame="frame"
height="#{appController.dataModel.tableHeight}px"
width="#{appController.dataModel.tableWidth}px"
styleClass="table_standard"
rowClasses="row_ext_even,row_ext_odd"
sortMode="single"
selectionMode="none"
tableState="#{appController.dataModel.tableState}"
groupingColumn="#{appController.dataModel.groupingColumn}"
rows="#{appController.currPreparedDataSize}"
noDataLabel="#{appController.currSelTitle} #{appController.currPreparedDataSize} #{messages['recordsFoundTitle']} [*** NO DATA ***]"
rendered="#{appController.currSelectionAvailable}">
{code}
In the bean (note complete code prepares widths dynamically + programmatically)
{code}
/** State String */
private String tableState;
/**
* return associated state
* @return String
*/
public String getTableState() {
if (this.tableState == null) {
this.tableState = prepareTableState();
}
if (log.isDebugEnabled())
log.debug(getClass().getSimpleName() + " getTableState() = " + (tableState != null ? tableState : "null"));
return this.tableState;
}
/**
* set associated state
* @param state TableState String
*/
public void setTableState(String state) {
if (log.isDebugEnabled())
log.debug(getClass().getSimpleName() + " setTableState() = " + (state != null ? state : "null"));
if (this.tableState == null) {
this.tableState = prepareTableState();
if (this.tableState == null)
this.tableState = state;
} else {
this.tableState = state;
}
}
/** Number of table state columns */
private static final int NBR_TABLE_STATE_COLS = 10;
/** Default table column width */
private static final int DEFAULT_TABLE_STATE_COL_WIDTH = ControllerHelper.DEFAULT_COL_WIDTH;
/**
* get associated table state
*/
private static final String TABLE_STATE_FORMAT = "{\"columnsVisibility\":{" +
"\"col0\":\"1\"," +
"\"col1\":\"1\"," +
"\"col2\":\"1\"," +
"\"col3\":\"1\"," +
"\"col4\":\"1\"," +
"\"col5\":\"1\"," +
"\"col6\":\"1\"," +
"\"col7\":\"1\"," +
"\"col8\":\"1\"," +
"\"col9\":\"1\"}" +
",\"columnGroupingState\":{},\"columnsSizeState\":{" +
"\"col0\":\"5\"," +
"\"col1\":\"7\"," +
"\"col2\":\"10\"," +
"\"col3\":\"12\"," +
"\"col4\":\"14\"," +
"\"col5\":\"17\"," +
"\"col6\":\"25\"," +
"\"col7\":\"30\"," +
"\"col8\":\"35\"," +
"\"col9\":\"40\"}" +
",\"columnsOrder\":[" +
"\"col0\"," +
"\"col1\"," +
"\"col2\"," +
"\"col3\"," +
"\"col4\"," +
"\"col5\"," +
"\"col6\"," +
"\"col7\"," +
"\"col8\"," +
"\"col9\"]}";
/**
* prepare a table state format using specified column widths
*/
public String prepareTableState() {
return TABLE_STATE_FORMAT;
}
{code}
was (Author: entracity):
As requested in https://issues.jboss.org/browse/RF-13126 - The following defines the table with tableState:
<rich:extendedDataTable
id="contTable"
var="b"
value="#{appController.dataModel}"
enableContextMenu="false"
frame="frame"
height="#{appController.dataModel.tableHeight}px"
width="#{appController.dataModel.tableWidth}px"
styleClass="table_standard"
rowClasses="row_ext_even,row_ext_odd"
sortMode="single"
selectionMode="none"
tableState="#{appController.dataModel.tableState}"
groupingColumn="#{appController.dataModel.groupingColumn}"
rows="#{appController.currPreparedDataSize}"
noDataLabel="#{appController.currSelTitle} #
{appController.currPreparedDataSize} #{messages['recordsFoundTitle']} [*** NO DATA ***]"
rendered="#{appController.currSelectionAvailable}">
-------------------------------------------
In the bean (note complete code prepares widths dynamically + programmatically)
-------------------------------------------
/** State String */
private String tableState;
/**
* return associated state
* @return String
*/
public String getTableState() {
if (this.tableState == null) {
this.tableState = prepareTableState();
}
if (log.isDebugEnabled())
log.debug(getClass().getSimpleName() + "
getTableState() = " + (tableState != null ? tableState : "null"));
return this.tableState;
}
/**
* set associated state
* @param state TableState String
*/
public void setTableState(String state) {
if (log.isDebugEnabled())
log.debug(getClass().getSimpleName() + " setTableState() = " + (state != null ? state : "null"));
if (this.tableState == null) {
this.tableState = prepareTableState();
if (this.tableState == null)
this.tableState = state;
} else {
this.tableState = state;
}
}
/** Number of table state columns */
private static final int NBR_TABLE_STATE_COLS = 10;
/** Default table column width */
private static final int DEFAULT_TABLE_STATE_COL_WIDTH =
ControllerHelper.DEFAULT_COL_WIDTH;
/**
* get associated table state
*/
private static final String TABLE_STATE_FORMAT =
"{\"columnsVisibility\":{" +
"\"col0\":\"1\"," +
"\"col1\":\"1\"," +
"\"col2\":\"1\"," +
"\"col3\":\"1\"," +
"\"col4\":\"1\"," +
"\"col5\":\"1\"," +
"\"col6\":\"1\"," +
"\"col7\":\"1\"," +
"\"col8\":\"1\"," +
"\"col9\":\"1\"}" +
",\"columnGroupingState\":{},\"columnsSizeState\":{" +
"\"col0\":\"5\"," +
"\"col1\":\"7\"," +
"\"col2\":\"10\"," +
"\"col3\":\"12\"," +
"\"col4\":\"14\"," +
"\"col5\":\"17\"," +
"\"col6\":\"25\"," +
"\"col7\":\"30\"," +
"\"col8\":\"35\"," +
"\"col9\":\"40\"}" +
",\"columnsOrder\":[" +
"\"col0\"," +
"\"col1\"," +
"\"col2\"," +
"\"col3\"," +
"\"col4\"," +
"\"col5\"," +
"\"col6\"," +
"\"col7\"," +
"\"col8\"," +
"\"col9\"]}";
/**
* prepare a table state format using specified column widths
*/
public String prepareTableState() {
return TABLE_STATE_FORMAT;
}
> extendedDataTable tableState setter not called on column resize/reorder
> -----------------------------------------------------------------------
>
> Key: RF-13095
> URL: https://issues.jboss.org/browse/RF-13095
> Project: RichFaces
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: component-tables
> Affects Versions: 4.3.2
> Environment: GlassFish 3.1.2.2 with Mojarra 2.1.23, tested on Firefox 22 and Chrome 28.
> Reporter: Salvo Isaja
> Assignee: Brian Leathem
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> Not sure if this qualifies as a bug or a feature request.
> I have an extendedDataTable with the tableState attribute bound to a String property of a backing bean (tried both a request scoped bean on a transient view and a session scoped bean on a stateful view).
> When resizing or reordering columns, an Ajax request is posted to the server, and I correctly see the new column layouts in the request, but the setter of the tableState property in the backing bean is not called. If I execute @form on a a4j:commandLink or commandButton, it is called instead.
> Thanks
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the richfaces-issues
mailing list