You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org> on 2007/07/18 16:04:05 UTC
[jira] Commented: (TOMAHAWK-1031) links from sortable table are not
working (with TRINIDAD)
[ https://issues.apache.org/jira/browse/TOMAHAWK-1031?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513576 ]
Martin Marinschek commented on TOMAHAWK-1031:
---------------------------------------------
I believe sortColumn and sortAscending are set to null so that you can change the values in the managed bean, so this is not the full solution - sorry!
regards,
Martin
> links from sortable table are not working (with TRINIDAD)
> ---------------------------------------------------------
>
> Key: TOMAHAWK-1031
> URL: https://issues.apache.org/jira/browse/TOMAHAWK-1031
> Project: MyFaces Tomahawk
> Issue Type: Bug
> Environment: windows xp, jboss 4.2.0.GA
> Reporter: Leonardo Uribe
> Attachments: patch2.patch
>
>
> When you mix trinidad and tomahawk CommandSortHeader component it not works.
> I believe that I have found the reason. Take a look at this code
> (please note only the part where _sortColumn and _sortAscending is set to null):
> /**
> * Specify what column the data should be sorted on.
> * <p/>
> * Note that calling this method <i>immediately</i> stores the value
> * via any value-binding with name "sortColumn". This is done because
> * this method is called by the HtmlCommandSortHeader component when
> * the user has clicked on a column's sort header. In this case, the
> * the model getter method mapped for name "value" needs to read this
> * value in able to return the data in the desired order - but the
> * HtmlCommandSortHeader component is usually "immediate" in order to
> * avoid validating the enclosing form. Yes, this is rather hacky -
> * but it works.
> */
> public void setSortColumn(String sortColumn)
> {
> _sortColumn = sortColumn;
> // update model is necessary here, because processUpdates is never called
> // reason: HtmlCommandSortHeader.isImmediate() == true
> ValueBinding vb = getValueBinding("sortColumn");
> if (vb != null)
> {
> vb.setValue(getFacesContext(), _sortColumn);
> _sortColumn = null;
> }
> setSortColumnIndex(columnNameToIndex(sortColumn));
> }
> public String getSortColumn()
> {
> if (_sortColumn != null) return _sortColumn;
> ValueBinding vb = getValueBinding("sortColumn");
> return vb != null ? (String) vb.getValue(getFacesContext()) : null;
> }
> public void setSortAscending(boolean sortAscending)
> {
> _sortAscending = Boolean.valueOf(sortAscending);
> // update model is necessary here, because processUpdates is never called
> // reason: HtmlCommandSortHeader.isImmediate() == true
> ValueBinding vb = getValueBinding("sortAscending");
> if (vb != null)
> {
> vb.setValue(getFacesContext(), _sortAscending);
> _sortAscending = null;
> }
> }
> public boolean isSortAscending()
> {
> if (_sortAscending != null)
> return _sortAscending.booleanValue();
> ValueBinding vb = getValueBinding("sortAscending");
> Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext()) : null;
> return v != null ? v.booleanValue() : DEFAULT_SORTASCENDING;
> }
> If you set _sortColumn and _sortAscending variables to null, when this method is executed:
> public Object saveState(FacesContext context)
> {
> /*.......*/
> values[5] = _sortColumn;
> values[6] = _sortAscending;
> /*.......*/
> }
> the variables are saved as null!! (but the ValueBinding no)
> If you remove this lines:
> _sortColumn = null;
> and
> _sortAscending = null;
> I probe it and it works well ( I think that this error is related to TOMAHAWK-457)
> Trinidad use its own StateManager impl. So I believe that this is the reason of TOMAHAWK-457 (RI has a different StateManagerImpl).
> But I'm not sure if this should be done or something like this:
> _sortColumn = getValueBinding("sortColumn").getValue(getFacesContext());
> What do you think in order to create a properly patch
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.