GWT DataGrid/CellTable: Select all over multiple pages - gwt

I´m using GWT 2.4 with a DataGrid and a SimplePager along with a MultiSelectionModel. I want to implement a simple select-all-feature over all pages.
I´m only able to select all visible items on the current page. What is the best way to select all items on all pages?
I know the MultiSelectionModel stores the proxy keys provided by a ProvidesKey object in a HashMap. I think I have to request all proxy objects from server or at least all keys. But actually I don´t want to store information about the ProvidesKey´s getKey()-method on server-side. But I also can not access the MultiSelectionModel´s HashMap of the selected proxies´ keys. This all looks cumbersome, so is there a better way to solve this?

As mentioned in https://developers.google.com/web-toolkit/doc/latest/DevGuideUiCellWidgets#selection, one way to achieve this would be to implement your own SelectionModel (e.g. by extending AbstractSelectionModel or DefaultSelectionModel):
A complex implementation can handle "select all" across multiple pages using a boolean to indicate that everything is selected, and then keep track of negative selections.

Why do you need all keys for select all? When you select some objects from a list, you need to remember which ones are selected, but when you select all objects, you need a single Boolean:
// on click Select All button/checkbox
boolean selectAll = true;
// ask a user what he wants to do
// send a request to server with a parameter selectAll to update/delete all objects

Select all across multiple pages will work only if you are NOT lazy loading. First of all why do you need to select all? If you want to do some actions on all the grid data, you will already have the list and you can perform your actions on the list directly. Nonetheless you can select all the rows of the grid over multiple pages by iterating through the list and using the following API on each item.
public void setSelected(T item, boolean selected);
Note: This will work only if you are NOT lazy loading.

Related

How to Ignore selected rows when filtering using floating filters in ag-grid?

I'm currently working on a project that uses ag-grid in Angular.
We have a table that displays some sort of data and it's possible to filter this table using some textbox floating filters above the table for every column.
Every row has a checkmark in the beginning that can be used to select this row.
The goal is to figure out a way to not filter out the rows that have been selected by the user. The rest of the rows should get filtered as normal.
Is there an easy way to implement this?
I've been looking trough the documentation and it seems like I will have to write a custom filter component, but I'm not sure where to start. Do filters even have the capability to check if a row is selected or not?
So I figured out an easy way. I created a new simple class:
export class IgnoreSelectionFilter extends TextFilter {
doesFilterPass(params: IDoesFilterPassParams): boolean {
if (params.node.isSelected()) return true;
else return super.doesFilterPass(params);
}
}
I use this class as the "filter" component for every column where this functionality is required. This new class behaves exactly like agTextColumnFilter, but first it will verify if the node is selected or not and ignore it if it's selected.

Where are stored filter params in magento 2?

I need to export the products catalog after I applied a filter. I made a custom button for this, but in the query I need the filters already applied on the grid. Is it possible to get them from the global variable? I noticed that if I refresh the page, the filters are kept, but I do not know where they are from.
You can find applied filters data at the ui_bookmark table of your database;
SELECT `namespace`, `config` FROM `ui_bookmark`;

Grouping expand and collapse in GWT

I have multiple records which needs to be displayed as part of a search. A single result can contain multiple records associated to it. If there are multiple records I need to display the record with (+) and when clicked it further displays the list.
I would like to know what the best way is to implement ( I have checked Custom data grid ex: http://gwt.googleusercontent.com/samples/Showcase/Showcase.html#!CwCustomDataGrid but would like to use UI binder)
Once the user selects a record from the expanded list, how can we load that selected record?
Any pointer are appreciated..! ( Currently on GWT 2.2)
Widget list
Tree or maybe StackPanel seems like it would be useful here.

APEX - Can a Tabular Form with its MRU functionality have filtering functionality like an Interactive Report?

What I really need is a Tabular form that allows me to update multiple rows at a time while being filterable like an Interactive report. Any chance this is even remotely possible?
I would also like to hijack the row checkboxes on a tabular form that appear when the 'delete' functionality is activated and use them to select which rows get assigned a to a group based on a common attribute. (i.e. My table contains parts in my inventory and I need to be able to assign parts with common attributes to a group for processing)
Perhaps a group-by function that creates a new row in a 'Group' table with the group as the PK and the parts assigned to that group as a list or something...?
Thoughts? I am kind of at a loss...
It's really not that hard :) You can easily transform an IR into a pseudo-tabular form. And even though there are always more stylish and elegant solutions, those usually involve lots of javascript and/or plugins. They're nice, but not always what you want or need of course.
So how to manipulate your output? Use the APEX_ITEM api!
Quick example. I have an ir built on emp. I added a checkbox and textbox.
select empno, ename, deptno,
apex_item.checkbox(1, empno) empno_selected,
apex_item.text(2, ename, 10, 10) ename_edit
from emp
Don't forget: in the column attributes, set Display text as to Standard Report Column. If you don't, the output will be in plain text. Since apex_item generates html code, you don't want the plain text of course :)
Now, to be able to perform DML based on the actions you do in those generated fields, you will need a process. Let me start off by pointing out though that the generated items are stored in application variables, namely in arrays in APEX_APPLICATION.
Take note of the behaviour of checkboxes: only ticked boxes will have their value stored in the array!
As an example, i've made this small On Submit process (also adding a SUBMIT button on the form to actually perform the submit...)
for i in 1..apex_application.g_f01.count
loop
insert into empselected(empno, selectiondate, ename_changed)
values(apex_application.g_f01(i), sysdate, apex_application.g_f02(i));
end loop;
This will loop over the records with the checkboxes ticked, and insert them into some table. For example, i ticked the box with KING and edited the textfield. See record nr 2 (1 is from a previous action ;))
It's not all the way there yet though. You still miss out on the functionality of a tabular form and it's processes, and things like optimistic locking. If you want to stay with tabular forms, you can also, for example, check out this link. There have also been some questions here about writing your own mru processes etc, like this one ;)
It is possisble, using the same tabular form.
Create an item (text item) in the tabular form region.
Create a submit button (Create a button displayed among this region's items)
Modify the where clause in the tabular form region source
For Example, you need search by customer name:
WHERE lower(CUSTOMER_NAME) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
If you need to search for other field only add other condition to the where clause
WHERE (
lower(CUSTOMER_NAME) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
or lower(CUSTOMER_address) LIKE '%'||lower(nvl(:PXX_SEARCH,CUSOTOMER_NAME))||'%'
)
Simple and use the same tabular form.

struts2 select tag, second select based on value of first select

I have 2 select, I want the second select list loads based on selected value of first select. In another word first select is a list of objects, those objects each has a list of another objects. so I want load second list based on selected object of first select. I know that can be done using JQuery, but can I do this without JavaScript/JQuery?
Thanks in advance.
There is a tag that does this for you http://struts.apache.org/2.x/docs/doubleselect.html
Out of the box it probably uses Dojo API or uses a server side request to generate the second list. I have not used any of the JQuery UI in Struts.
No, you can't do this without Javascript. With static HTML you can't achieve this effect; drop-down fields on HTML forms come pre-loaded with their options, and are independent of other fields on the form.