You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/10/29 11:34:55 UTC

Datatable manipulation - valueBinding ignored?

Hi again,

 

I am currently despairing of manipulating and updating a datatable.

First I thought this would be an ajax issue but the problem does also
occur with normal command links.

 

Szenario:

I have a datatable with e.g. 100 records and each page of my datatable
shows 20 records. (I use the PagedListDataModel in order to load data on
request)

When I navigate to page 4 then the first record of the datatable is nr
80.

Moreover I have some command links in order to filter the datamodel.

This means that the total number of elements in the underlying model is
updated.

I click such a filter and the total number of documents in the
underlying model is changed to 15.

So far so good.

The problem now is that the "first" attribute of the underlying
HtmlDataTable is not updated correctly and stays with the old value
(80).

 

I use a valueBinding for this attribute and I set the value to 0 in the
actionListener FilterController.addFilter().

When I now leave this page via a normal output link and come back to
this page, then the datatable is displayed correctly.

 

I set a breakpoint into the renderer of my datascroller at the bottom of
my page.

The HtmlDataTable's (returned via
uiComponent.findComponent("docform:doclist") first attribute is still 80

and MyController.documentModelFirstRecord is 0.

 

So why is this not working?

What do I miss here?

 

Snippets:

  <t:dataTable

  id="doclist"

  value="#{MyController.documentModel}"

  var="doc"

  rows="#{MyController.documentModelRowsPerPage}" 

  first="#{MyController.documentModelFirstRecord}"


  renderedIfEmpty="false"

  rowCountVar="rowcount"

  preserveDataModel="false">

    ...

 </t:dataTable>

 

 

 <t:commandLink immediate="false"

    actionListener="#{FilterController.addFilter}">

 

I use myFaces core 1.1.4 and tomahawk 1.1.3

 

Thanks for any help

Michael


RE: Datatable manipulation - valueBinding ignored?

Posted by Michael Heinen <mh...@recommind.com>.
Jeff,

Thanks, I know this page and it is a very useful contribution.

But it does not deal with the fact, that the datascroller erases the
value binding of the first attribute. This was a very painful experience
to me.
I noticed this as I ajaxified my datatables and scrollers.

I solved this as supposed by Andrew Robinson in this thread:
http://marc.theaimsgroup.com/?l=myfaces-user&m=114529361608223&w=2
(***Many thanks to Andrew***)

But I did not update the valueBinding in the setter.
I manage this property in my actionListener that executes the scrolling
public void setFirst(int first)
{
  ValueBinding vb = getValueBinding("first");
  if (vb != null)
  {
    return; //Don't update anything if a VB is used !!!
  }
  else
    if (_preservedDataModel != null)
    {
        //Also change the currently restored DataModel attribute
        _preservedDataModel.setFirst(first);
    }
    super.setFirst(first);
}  


I hope that this will become part of the tomahawk datatable.
The datable cannot be used in complex use cases without this patch.
(E.g. an AJAX call that reduces the number of pages in the datatable.
See description below)

Could anybody of the developers comment this?

Michael

-----Original Message-----
From: Jeff Bischoff [mailto:jbischoff@klkurz.com] 
Sent: Montag, 30. Oktober 2006 16:38
To: MyFaces Discussion
Subject: Re: Datatable manipulation - valueBinding ignored?

Michael,

I already replied to you on the ajax4jsf list, but since this is not an 
Ajax issue, I will repeat my post here.

I have contributed a wiki page [1] that attempts to offer some options 
for dealing with this situation. Maybe it can help? I highly recommend 
managing the "first" attribute yourself.

[1] http://wiki.apache.org/myfaces/ManagingDataScrollerPage

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Michael Heinen wrote:
> Now I found another thread with exactly the same problem.
> 
> http://marc.theaimsgroup.com/?l=myfaces-user&m=114529361608223&w=2
> 
>  
> 
> If the scroller has been once clicked then the valueBinding of the
first
> attribute is overwritten with an Integer.
> 
> With this behaviour I cannot manipulate the datatable anymore.
> 
> Is this a bug or an issue that will be officially solved in the near
> future?
> 
>  
> 
> Michael
> 
>  
> 
> ________________________________
> 
> From: Michael Heinen [mailto:mhn@recommind.com] 
> Sent: Sonntag, 29. Oktober 2006 11:35
> To: MyFaces Discussion
> Subject: Datatable manipulation - valueBinding ignored?
> 
>  
> 
> Hi again,
> 
>  
> 
> I am currently despairing of manipulating and updating a datatable.
> 
> First I thought this would be an ajax issue but the problem does also
> occur with normal command links.
> 
>  
> 
> Szenario:
> 
> I have a datatable with e.g. 100 records and each page of my datatable
> shows 20 records. (I use the PagedListDataModel in order to load data
on
> request)
> 
> When I navigate to page 4 then the first record of the datatable is nr
> 80.
> 
> Moreover I have some command links in order to filter the datamodel.
> 
> This means that the total number of elements in the underlying model
is
> updated.
> 
> I click such a filter and the total number of documents in the
> underlying model is changed to 15.
> 
> So far so good.
> 
> The problem now is that the "first" attribute of the underlying
> HtmlDataTable is not updated correctly and stays with the old value
> (80).
> 
>  
> 
> I use a valueBinding for this attribute and I set the value to 0 in
the
> actionListener FilterController.addFilter().
> 
> When I now leave this page via a normal output link and come back to
> this page, then the datatable is displayed correctly.
> 
>  
> 
> I set a breakpoint into the renderer of my datascroller at the bottom
of
> my page.
> 
> The HtmlDataTable's (returned via
> uiComponent.findComponent("docform:doclist") first attribute is still
80
> 
> and MyController.documentModelFirstRecord is 0.
> 
>  
> 
> So why is this not working?
> 
> What do I miss here?
> 
>  
> 
> Snippets:
> 
>   <t:dataTable
> 
>   id="doclist"
> 
>   value="#{MyController.documentModel}"
> 
>   var="doc"
> 
>   rows="#{MyController.documentModelRowsPerPage}" 
> 
>   first="#{MyController.documentModelFirstRecord}"
> 
> 
>   renderedIfEmpty="false"
> 
>   rowCountVar="rowcount"
> 
>   preserveDataModel="false">
> 
>     ...
> 
>  </t:dataTable>
> 
>  
> 
>  
> 
>  <t:commandLink immediate="false"
> 
>     actionListener="#{FilterController.addFilter}">
> 
>  
> 
> I use myFaces core 1.1.4 and tomahawk 1.1.3
> 
>  
> 
> Thanks for any help
> 
> Michael
> 
> 







Re: Datatable manipulation - valueBinding ignored?

Posted by Jeff Bischoff <jb...@klkurz.com>.
Michael,

I already replied to you on the ajax4jsf list, but since this is not an 
Ajax issue, I will repeat my post here.

I have contributed a wiki page [1] that attempts to offer some options 
for dealing with this situation. Maybe it can help? I highly recommend 
managing the "first" attribute yourself.

[1] http://wiki.apache.org/myfaces/ManagingDataScrollerPage

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Michael Heinen wrote:
> Now I found another thread with exactly the same problem.
> 
> http://marc.theaimsgroup.com/?l=myfaces-user&m=114529361608223&w=2
> 
>  
> 
> If the scroller has been once clicked then the valueBinding of the first
> attribute is overwritten with an Integer.
> 
> With this behaviour I cannot manipulate the datatable anymore.
> 
> Is this a bug or an issue that will be officially solved in the near
> future?
> 
>  
> 
> Michael
> 
>  
> 
> ________________________________
> 
> From: Michael Heinen [mailto:mhn@recommind.com] 
> Sent: Sonntag, 29. Oktober 2006 11:35
> To: MyFaces Discussion
> Subject: Datatable manipulation - valueBinding ignored?
> 
>  
> 
> Hi again,
> 
>  
> 
> I am currently despairing of manipulating and updating a datatable.
> 
> First I thought this would be an ajax issue but the problem does also
> occur with normal command links.
> 
>  
> 
> Szenario:
> 
> I have a datatable with e.g. 100 records and each page of my datatable
> shows 20 records. (I use the PagedListDataModel in order to load data on
> request)
> 
> When I navigate to page 4 then the first record of the datatable is nr
> 80.
> 
> Moreover I have some command links in order to filter the datamodel.
> 
> This means that the total number of elements in the underlying model is
> updated.
> 
> I click such a filter and the total number of documents in the
> underlying model is changed to 15.
> 
> So far so good.
> 
> The problem now is that the "first" attribute of the underlying
> HtmlDataTable is not updated correctly and stays with the old value
> (80).
> 
>  
> 
> I use a valueBinding for this attribute and I set the value to 0 in the
> actionListener FilterController.addFilter().
> 
> When I now leave this page via a normal output link and come back to
> this page, then the datatable is displayed correctly.
> 
>  
> 
> I set a breakpoint into the renderer of my datascroller at the bottom of
> my page.
> 
> The HtmlDataTable's (returned via
> uiComponent.findComponent("docform:doclist") first attribute is still 80
> 
> and MyController.documentModelFirstRecord is 0.
> 
>  
> 
> So why is this not working?
> 
> What do I miss here?
> 
>  
> 
> Snippets:
> 
>   <t:dataTable
> 
>   id="doclist"
> 
>   value="#{MyController.documentModel}"
> 
>   var="doc"
> 
>   rows="#{MyController.documentModelRowsPerPage}" 
> 
>   first="#{MyController.documentModelFirstRecord}"
> 
> 
>   renderedIfEmpty="false"
> 
>   rowCountVar="rowcount"
> 
>   preserveDataModel="false">
> 
>     ...
> 
>  </t:dataTable>
> 
>  
> 
>  
> 
>  <t:commandLink immediate="false"
> 
>     actionListener="#{FilterController.addFilter}">
> 
>  
> 
> I use myFaces core 1.1.4 and tomahawk 1.1.3
> 
>  
> 
> Thanks for any help
> 
> Michael
> 
> 



RE: Datatable manipulation - valueBinding ignored?

Posted by Michael Heinen <mh...@recommind.com>.
Now I found another thread with exactly the same problem.

http://marc.theaimsgroup.com/?l=myfaces-user&m=114529361608223&w=2

 

If the scroller has been once clicked then the valueBinding of the first
attribute is overwritten with an Integer.

With this behaviour I cannot manipulate the datatable anymore.

Is this a bug or an issue that will be officially solved in the near
future?

 

Michael

 

________________________________

From: Michael Heinen [mailto:mhn@recommind.com] 
Sent: Sonntag, 29. Oktober 2006 11:35
To: MyFaces Discussion
Subject: Datatable manipulation - valueBinding ignored?

 

Hi again,

 

I am currently despairing of manipulating and updating a datatable.

First I thought this would be an ajax issue but the problem does also
occur with normal command links.

 

Szenario:

I have a datatable with e.g. 100 records and each page of my datatable
shows 20 records. (I use the PagedListDataModel in order to load data on
request)

When I navigate to page 4 then the first record of the datatable is nr
80.

Moreover I have some command links in order to filter the datamodel.

This means that the total number of elements in the underlying model is
updated.

I click such a filter and the total number of documents in the
underlying model is changed to 15.

So far so good.

The problem now is that the "first" attribute of the underlying
HtmlDataTable is not updated correctly and stays with the old value
(80).

 

I use a valueBinding for this attribute and I set the value to 0 in the
actionListener FilterController.addFilter().

When I now leave this page via a normal output link and come back to
this page, then the datatable is displayed correctly.

 

I set a breakpoint into the renderer of my datascroller at the bottom of
my page.

The HtmlDataTable's (returned via
uiComponent.findComponent("docform:doclist") first attribute is still 80

and MyController.documentModelFirstRecord is 0.

 

So why is this not working?

What do I miss here?

 

Snippets:

  <t:dataTable

  id="doclist"

  value="#{MyController.documentModel}"

  var="doc"

  rows="#{MyController.documentModelRowsPerPage}" 

  first="#{MyController.documentModelFirstRecord}"


  renderedIfEmpty="false"

  rowCountVar="rowcount"

  preserveDataModel="false">

    ...

 </t:dataTable>

 

 

 <t:commandLink immediate="false"

    actionListener="#{FilterController.addFilter}">

 

I use myFaces core 1.1.4 and tomahawk 1.1.3

 

Thanks for any help

Michael