p:datatable selection problem after upgrade to PF 5.2 RC

UI Components for JSF
djmj
Posts: 400
Joined: 16 Dec 2011, 01:23

27 Apr 2015, 23:53

What about enhancing this approach using a JSF converter since it follows the same conversion idea and provides a clean reusable interface?

In my generic DAO's my overriden methods simply call the converter method.
A converter could also be passed to datatable attribute in markup as in any other component.

Code: Select all


public class MyJsfGenericDAO <T extends Entity> extends LazyDataModel<T>
{
	private final Converter converter;

	public MyJsfGenericDAO(...)
        {
            this.converter = new MyEntityConverter(entities);
        }


	@Override
	public Object getRowKey(final T t)
	{
		return this.converter.getAsString(FacesContext.getCurrentInstance(), null, t);
	}

	@Override
	public T getRowData(final String rowKey)
	{
		return (T) this.converter.getAsObject(FacesContext.getCurrentInstance(), null, rowKey);
	}
}

Primefaces: 11.0.0 RC2
Primefaces-Extension: 11.0.0
PrimeFaces-Mobile: 11.0
OmniFaces: 3.11
Jsf: Mojarra 2.3.8
Server: Glassfish 5.1.0

rider
Posts: 497
Joined: 05 Mar 2010, 13:17

30 Apr 2015, 23:11

why did you change this?
I cannot find any advantage for this! Why changing a running system?
For me it´s a showstopper to migrate to 5.2. I have ± 100 lazy datatables in my application.
I have to adjust all this lazy datatables. I´m sorry but this is wasting my time :roll:
Primefaces 12.0, WildFly 21

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

01 May 2015, 01:41

If I read it correctly, many (including me) used it not like it was intended. So from the PF point of view they did not change it or at least did not break backwards compatibility. But someone from the PFteam may state otherwise.

I am btw lucky. My LazyJPADatamodel uses genericks, so chaning one file fixes it for all (ok almost all, not the few ones with composite keys).

matsa
Posts: 62
Joined: 12 Sep 2011, 11:14

05 May 2015, 10:07

I've got a non-lazy related problem with this upgrade:

For non-lazy tables I use a generic data model like this:

Code: Select all

class GenericDataModel<T> extends ListDataModel<T> implements SelectableDataModel<T>, Serializable
Selection on this model has worked fine because I've implemented getRowKey/getRowData thusly:

Code: Select all

@Override
    public Object getRowKey(T object)
    {
        return container.getConverter().getAsString(FacesContext.getCurrentInstance(), null, object);
    }

    @Override
    public T getRowData(String rowKey)
    {
        return (T) container.getConverter().getAsObject(FacesContext.getCurrentInstance(), null, rowKey);
    }
On upgrade to 5.2(.1) this data model stopped working. None of the data tables had the rowKey attribute defined and selections are always empty. I understand how rowKey makes sense when using list as data model directly but in this case I've implemented SelectableDataModel.
Tomcat 9.0
JSF 2.2 (Mojarra 2.2.15)
PrimeFaces 10.0.5

holden
Posts: 2
Joined: 25 Feb 2015, 23:39

11 May 2015, 14:53

Hi *,

I get the same problem with data table selection, the returning set is always empty.
Also ajax selection events are triggered, but the event.getObject returns null.
This problem occurs since 5.2 RC and is still present with 5.2(.2).
matsa wrote:On upgrade to 5.2(.1) this data model stopped working. None of the data tables had the rowKey attribute defined and selections are always empty. I understand how rowKey makes sense when using list as data model directly but in this case I've implemented SelectableDataModel.
Can you kindly check it?

Regards,

holden
Posts: 2
Joined: 25 Feb 2015, 23:39

11 May 2015, 15:01

Hi *,

I get the same problem above, with no lazy loading and selection: the selected set is always empty;
the ajax selection event is triggered but event.getObject returns always null.

The issue occurs since 5.2 RC, and it's still present in 5.2.2

Can you kindly check it?

Regards

juanise
Posts: 5
Joined: 12 May 2015, 12:21

12 May 2015, 12:38

I prefer the old system, I do not know why you restrict the way we use datatables, in my case a have a lazy datatable that mix entities from database and others from my app.
It works ok before I update to 5.2.

:( :( :( :(
Primefaces 5.2
Mojarra 2.1.6
Extensions 3.1

matsa
Posts: 62
Joined: 12 Sep 2011, 11:14

22 May 2015, 11:45

Someone at PrimeTek should really respond to this. I've gotten great value from the SelectableDataModel I've described in my previous post and I won't be able to migrate beyond 5.1 until someone tells me how to handle this.
Tomcat 9.0
JSF 2.2 (Mojarra 2.2.15)
PrimeFaces 10.0.5

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

22 May 2015, 11:54

There is already a issue: https://github.com/primefaces/primefaces/issues/229
We will fix it as soon as possible.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

matsa
Posts: 62
Joined: 12 Sep 2011, 11:14

22 May 2015, 12:29

That's great!

It seems to be a duplicate of: https://github.com/primefaces/primefaces/pull/230

There's already a pull request available it seems!

Looking forward to moving past 5.1. :)
Tomcat 9.0
JSF 2.2 (Mojarra 2.2.15)
PrimeFaces 10.0.5

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests