java primefaces datatable selection counting - java

I've got a primefaces datatable with some data generated, with multiple selection and pagination and i have to count all the selected rows on each page and i done this but the problem is that i have to count also the number of subpages with selected items on it. So if i check 3 items on page number 1 and 3 items on page number 3 i want an output like: selected: 6 subpages: 2. Is there an easy way to count subpages ? For counting rows i just use a lenght of selected items table. How can i do this ?

You could use a listener in the bean to get current page onselection and kept a tally.
EX.
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("someOformID:someTableId");
dataTable.getPage()

Related

Populate a Dropdown Based on Selection of Another Dropdown in GXT

I have a simple dropdown menu that when an item is selected from another dropdown, it should get populated by a set of values from the database based on the selection value of the second dropdown.
How can I do this in GXT 4?
I've put together an example and posted it to a gist. Would this work for you?
https://gist.github.com/branflake2267/65ea27e16868c546ea7e

JAVA. JTABLE - How to count currently selected row(s)

I need to count selected row for removing multiple rows. Please help with the steps.
Example in the picture I want to delete/remove those selected rows at the same time.
table.getSelectedRows().length

How to calculate Data from few columns of WebTable using Java

I have to calculate the webtable data.
A WebTable has 6 columns and 20 Rows. We have to calculate
On Form-1
addition of data in column1 (from row1 to row20)
addition of data in column2 ( from row1 to row20)
addition of data in column4= (from row1 to row20)
addition of data in column5= (from row1 to row20)
Similarly data on Form-2, and Form-3 with 6 columns and 20 Rows
But, On Form-4
6 columns available on that page but Rows are not 20. Rows count is not specific it might be anything less than 20.
Condition-1:
If addition of , then don’t count the values from that row. So, please suggest me how to program this in Java.
Page navigation point is at bottom
when Form-1 is open, page navigation is as shown below
1 - 2 - 3 - 4 - >
when Form-2 is open, page navigation is as shown below
<- 1 - 2 - 3 - 4 ->
when Form-4 is open, page navigation is as shown below
< - 1 - 2 - 3 - 4
I want to calculate the data of column1 from "Form-1,Form-2,Form-3 & Form-4".
Thanks in Advance.
Vivek

Retrieving listbox values in action class

I have two listboxes in my jsp where in I am dynamically retrieving values for the first listbox based on the previous dropdown selection made by the user. The user will then have an option to move selected values from first listbox to the second. I want to retrieve the values of second listbox in my action class. I tried the following but didn't succeed. Please help...
String[] listbox = request.getParameterValues("ToLB");
Following is my second listbox from which i need to retrieve values,
<select multiple size="8" name="ToLB" style="width:278px;" id="customerListToId"></select>
Solved it by myself.. jQuery worked for the above stated problem..

Read multiple selection from TableView in JavaFX 2.0

I am trying to get the selection from a TableView in JavaFX 2.0. I have stored 5 Persons (5 rows) in the TableView. The code to get the selection model is:
TableView<Person> tableView =
myStage.getTableView();
ObservableList<Person> selection =
tableView.getSelectionModel().getSelectedItems();
System.out.println(selection.size());
Now when I select multiple rows and then execute the method including the above code, the following prints the selection * 2 and sometimes the selection * 3. For example: I select all 5 rows and it prints out a size of 10 and sometimes 15!
What am I doing wrong here?
There is a bug with TableView returning duplicated items for selection made by shift-click.
As a workaround until fix you can try filter duplicated items by:
Set<Person> selection = new HashSet<Person>(tableView.getSelectionModel().getSelectedItems());

Categories