You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Simon Kitching (JIRA)" <de...@myfaces.apache.org> on 2006/01/22 09:46:06 UTC

[jira] Created: (MYFACES-1048) t:dataTable preserveModel has no option to refresh model before render

t:dataTable preserveModel has no option to refresh model before render
----------------------------------------------------------------------

         Key: MYFACES-1048
         URL: http://issues.apache.org/jira/browse/MYFACES-1048
     Project: MyFaces
        Type: Improvement
    Reporter: Simon Kitching


Currently, t:dataTable's preserveDataModel "permanently" preserves the model. This nicely ensures that the contents of the datamodel used at render time is the same at the following validation phase - critical for correct behaviour.

However it *keeps* the same data through to the next render phase too. This means that once a dataTable is initialised with data,
it never changes (the data gets "stale"). It would be nice to have an extra option for the data to be preserved between render and
postback, but then discarded before the next render so that fresh (non-stale) data can be fetched. 

In other words, the problem is that without preserveDataModel, dataTable has two fetches: at validate then at render.
The preserveDataModel reduces this to zero fetches. However having *one* fetch [before each render phase but not before validate phase) is also useful.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1048) t:dataTable preserveModel has no option to refresh model before render

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1048?page=comments#action_12363561 ] 

Martin Marinschek commented on MYFACES-1048:
--------------------------------------------

Don't think so.

See this code:

    public void encodeBegin(FacesContext context) throws IOException
    {
        if (!isRendered())
            return;

        if (_isValidChildren && !hasErrorMessages(context))
        {
            _preservedDataModel = null;
        }

> t:dataTable preserveModel has no option to refresh model before render
> ----------------------------------------------------------------------
>
>          Key: MYFACES-1048
>          URL: http://issues.apache.org/jira/browse/MYFACES-1048
>      Project: MyFaces
>         Type: Improvement
>     Reporter: Simon Kitching

>
> Currently, t:dataTable's preserveDataModel "permanently" preserves the model. This nicely ensures that the contents of the datamodel used at render time is the same at the following validation phase - critical for correct behaviour.
> However it *keeps* the same data through to the next render phase too. This means that once a dataTable is initialised with data,
> it never changes (the data gets "stale"). It would be nice to have an extra option for the data to be preserved between render and
> postback, but then discarded before the next render so that fresh (non-stale) data can be fetched. 
> In other words, the problem is that without preserveDataModel, dataTable has two fetches: at validate then at render.
> The preserveDataModel reduces this to zero fetches. However having *one* fetch [before each render phase but not before validate phase) is also useful.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1048) t:dataTable preserveModel has no option to refresh model before render

Posted by "Simon Kitching (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1048?page=comments#action_12363590 ] 

Simon Kitching commented on MYFACES-1048:
-----------------------------------------

Hmm..looks like you're right.

However method processUpdates has this:
        if (isPreserveDataModel())
        {
            updateModelFromPreservedDataModel(context);
        }
where updateModelFromPreservedDataModel does this:
        ValueBinding vb = getValueBinding("value");
        if (vb != null && !vb.isReadOnly(context))
        {
            _SerializableDataModel dm = (_SerializableDataModel) getDataModel();
            Class type = vb.getType(context);
            if (DataModel.class.isAssignableFrom(type))
            {
                vb.setValue(context, dm);
            }

So if the backing bean has a setDataModel(...) method then the preserved data model is pushed into the backing bean.
The _preservedDataModel of the component itself is then cleared, so the component will fetch the model via a binding
at render time. But if the backing bean does this:
   if (_myDataModel != null) {
     return _myDataModel;
  }
the object returned will be the same preserved dataModel! So maybe that's what's tricking myself (and others) into
thinking that preserveDataModel "permanently" preserves the data. I'll need to write some tests to see....

> t:dataTable preserveModel has no option to refresh model before render
> ----------------------------------------------------------------------
>
>          Key: MYFACES-1048
>          URL: http://issues.apache.org/jira/browse/MYFACES-1048
>      Project: MyFaces
>         Type: Improvement
>     Reporter: Simon Kitching

>
> Currently, t:dataTable's preserveDataModel "permanently" preserves the model. This nicely ensures that the contents of the datamodel used at render time is the same at the following validation phase - critical for correct behaviour.
> However it *keeps* the same data through to the next render phase too. This means that once a dataTable is initialised with data,
> it never changes (the data gets "stale"). It would be nice to have an extra option for the data to be preserved between render and
> postback, but then discarded before the next render so that fresh (non-stale) data can be fetched. 
> In other words, the problem is that without preserveDataModel, dataTable has two fetches: at validate then at render.
> The preserveDataModel reduces this to zero fetches. However having *one* fetch [before each render phase but not before validate phase) is also useful.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (MYFACES-1048) t:dataTable preserveModel has no option to refresh model before render

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ http://issues.apache.org/jira/browse/MYFACES-1048?page=comments#action_12363562 ] 

Martin Marinschek commented on MYFACES-1048:
--------------------------------------------

I would say that an option to store the datamodel even for the rendering phase would be positive!

regards,

Martin

> t:dataTable preserveModel has no option to refresh model before render
> ----------------------------------------------------------------------
>
>          Key: MYFACES-1048
>          URL: http://issues.apache.org/jira/browse/MYFACES-1048
>      Project: MyFaces
>         Type: Improvement
>     Reporter: Simon Kitching

>
> Currently, t:dataTable's preserveDataModel "permanently" preserves the model. This nicely ensures that the contents of the datamodel used at render time is the same at the following validation phase - critical for correct behaviour.
> However it *keeps* the same data through to the next render phase too. This means that once a dataTable is initialised with data,
> it never changes (the data gets "stale"). It would be nice to have an extra option for the data to be preserved between render and
> postback, but then discarded before the next render so that fresh (non-stale) data can be fetched. 
> In other words, the problem is that without preserveDataModel, dataTable has two fetches: at validate then at render.
> The preserveDataModel reduces this to zero fetches. However having *one* fetch [before each render phase but not before validate phase) is also useful.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira