Chart ItemSelectEvent series and item index possibly wrong

UI Components for JSF
Post Reply
rafaelri
Posts: 17
Joined: 01 Mar 2010, 15:05

02 Mar 2010, 14:09

Hi all,

I am running a test based on the sample provided on http://www.primefaces.org:8080/prime-sh ... rChart.jsf and added an itemSelectListener as follows:

Code: Select all

itemSelectListener="#{chart.itemSelect}"
with the following backing bean method:

Code: Select all

public void itemSelect(ItemSelectEvent event) {
     System.out.println(event.getItemIndex() + " " + event.getSeriesIndex());
}
The thing is it does not matter if I click on boys or girls on 2004 data it always prints:
09:07:26,351 INFO [STDOUT] 0 0
The same happens when I click on any series of 2005 it always prints:
09:07:46,617 INFO [STDOUT] 1 1

Shouldn't it be printing 0 0 and 0 1, respectively, when I click on boys 2004 and girls 2004 and also print 1 0 and 1 1 if I had clicked on the same series order but on 2005?

best regards,
Rafael Ribeiro

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2010, 12:56

Hi Rafael,

It seems to be a bug, can you please create an issue in our issue tracker and post the link here.

This seems quite easy to fix as well.

Thank you.

rafaelri
Posts: 17
Joined: 01 Mar 2010, 15:05

03 Mar 2010, 14:54

Done!
http://code.google.com/p/primefaces/iss ... ail?id=569

In the meantime I'll try to download and check if I can fix it myself then I submit you a patch!

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2010, 14:58

It should be trivial yes, itemSelectListener in charts.js file is the key. Problem is that on javascript side, I guess we are sending the wrong value.

rafaelri
Posts: 17
Joined: 01 Mar 2010, 15:05

03 Mar 2010, 15:29

I guess some js optimizer is run on charts.js so the change on the jar for the release is:

Code: Select all

D.seriesIndex=C.index;
becomes:

Code: Select all

D.seriesIndex=C.seriesIndex;
Or in case of charts.js on sources jar:

Code: Select all

params['seriesIndex'] = event.index;
becomes:

Code: Select all

params['seriesIndex'] = event.seriesIndex;

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Mar 2010, 18:15

Yes, in production all js are compressed.

Can you create an svn patch for this and attach to the issue.


Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Seo-Ul-But and 21 guests