I am using the jQuery DataTables plugin on a JSF <h:dataTable>
. In this page I have 86 records.
+++++++++++++++++++++++++++++++++++++
+ id + Name + Email +
+++++++++++++++++++++++++++++++++++++
+ 1 + Name 1 + Email 1 +
+ 2 + Name 2 + Email 2 +
+ 3 + Name 3 + Email 3 +
+........
+ 4 + Name 4 + Email 4 +
+++++++++++++++++++++++++++++++++++++
+ 1.2.3.4..... Next +
+++++++++++++++++++++++++++++++++++++
Note: Per table I am showing 10 records.
What my client want is add a column Views which will work as below.
When I open table I have 10 records, means id 1-10 get 1 view.
When I click pagination 2, id 11-20 get 1 view.
Any idea how to get this done?
Edit 1
What I meant by get 1 view
is as below.
User A : When page is opened, default pagination 1 is ON. So on page we have 10 records. Means all 10 records are viewed by user A, means each id get 1 view. SO now id 1-10 have 1 views. User A exits the page.
User B : When page is opened, default pagination 1 is ON. So on page we have 10 records. Means all 10 records are viewed by user B, means each id get 1 view. SO now id 1-10 have 2 views (as user A has already viewed). Now User B clicks pagination 2 button. So id 11-20 get view 1. User B exits the page.
This way I want to calculate views per id.
So basically what I want is
- When pagination button is pressed, I want to get ids that are on the table.
- Pass those ids to some bean and increase those id's views.
Any idea how to get this done?
Edit 2
Also check this
https://stackoverflow.com/a/16934279/1066828
Here I found all solution...