Vaadin 14 TreeGrid MultiSelection mode with hierarchical data - vaadin

I use TreeGrid to implement my filter with hierarchical data in multi-selection mode.
Sample
As you can see on the image above, the checkbox are checked for all three items. I would like to modify the parent checkbox(in this case "Default") to have some sort of selection indicator. If all children are selected, the checkbox will use a check mark as the indicator. If children are partially selected(not all), the checkbox will have ("-") sign to indicate that part of the items under this parent are selected and empty checkbox for zero item selected under parent.
I was trying implement this feature on my own, but i couldn't find a way to access the checkbox. Any idea?

Related

Vaadin gridpro - select all checkbox - not all checkbox are visually selected

We are using Vaadin gridpro v23.0.2 with Grid.SelectionMode.MULTI.
When I click on the select all check box all the record are selected (getAllSelectedItems), but the interface (view) is not updated, some rows of the list remain unselected. If i call refreshAll on the data provider than the rows are shown as selected. Is it a bug in the gridpro version ?
screenshot
Kind regards,
Raphaël
Make sure you have hashCode and equals properly implemented in your data bean; see https://vaadin.com/docs/latest/binding-data/data-provider/#data-binding.data-provider.item-identifiers . If you don't have them, the selection might not show up correctly.

How to select just one row, prevent to unselect item in singleselect mode

My question is very simple but I really didn't find any solution here.
I have a Table setSelectable(true), setMultiselect(false), setImmediate(true).
It works fine by first click and moving through the table using arrows.
But if I click again to the row already having been selected,
then it becomes unselected. How to prevent it?
I'd like to have kept just one row always selected.
As from the Vaadin Book here:
If the user clicks on an already selected item, the selection will deselected and the table property will have null value. You can disable this behaviour by setting setNullSelectionAllowed(false) for the table.
So:
table.setNullSelectionAllowed(false);

how to set maximum selection of checkbox in a dialog in advanced installer 8.9?

Advanced Installer 8.9
I have 9 check-box on a selection dialog ,on which i need to allow maximum selection of any three check-boxes.
We can show a message box displaying that only three can be selected or disable next button .
Trying to do permutation and combination will be a filthy task,is there any way where i can set a counter which increments on selection of check-boxes.
The easiest way is to create a very simple custom action in C# that checks the value of each property attached with your checkboxes. You need to call this DLL using a published event, from each checkbox, so when a user tries to select it, first the custom action checks to see if other checkboxes are not selected. If there are already 3 checkboxes selected then you need to delete the property of the new checkbox, like this:
session["CHECKBOX_PROP_1"] = "[~]";
Of course you can also use a C++ custom action if you prefer this language.

Rails-Haml, Table display of checkbox selection

I have a table that displays data for the items selected in the checkbox above, like a[], b[], c[]. Initially, when the page is first loaded, the table display is empty. When checkbox selections are made, the tables displays the data for the selection. Then when I untick all checkboxs and press display, the table display should be empty.
In the controller the variable for checkbox selection is thus>
#selected_brands = params[:brands] || session[:brands] || {}
as you may realize, params[], and session[] are values submitted by form in the view. {} -> when no checkboxes are selected.
Again in controller, I have this
#products = Product.find_all_by_brand(#selected_brands.keys)
The problem I have is, when I have unchecked the boxes, following the previous selections I made, the table displays data from previous session, instead of an empty table. What am I not doing?
You run into a HTML issue bugging lots of people: when you uncheck all checkboxes, nothing is sent to the server, and thus no change is recorded, so the last situation is still recorded.
There are many solutions to this (events, javascript, serverside code), so my advise is to broaden your search to generic html how to handle this situation best.
If you don't like Javascript, and have no problem with too many db-actions, remove all selected brands for the product and reapply the chosen ones when you get this result.

xxforms:tree view of xforms:select1 control

I am trying to display items retrieved from an XML DB using xforms:select1 control using appearance=xxforms:tree. The items appear collapsed or expanded automatically and the behaviour is not the same for all the items retrieved. I have the following questions regarding xxforms:tree view:
how to make sure this view shows sub-nodes (those expandable/collapsable using +/- icon) as collapsed or expanded always, irrespective of, for example, the no. of nodes covered by the + icon?
how to render select1 with tree appearance without making any of the items hyperlinks?
how to make sure no item is highlighted/selected by default?
...and although the docs say xxforms:menu is also a possible appearance (URL http://www.orbeon.com/orbeon/doc/reference-xforms-extensions#tree), the details are not available...
About which branches of the tree should be open — By default all the nodes leading to selected nodes are open, this so the selected values are all visible. But you can change this default behavior and specify which nodes should be open using the xxforms:open attribute. For more on this, see the section "Controlling which tree nodes are initially open" on Selection Controls. Note that this feature was added in October 2010, so it is not included in Orbeon Forms 3.8, and until Orbeon Forms 3.9 is released, you'll need to get a nightly build for this.
About using links in the tree — At this point, the nodes you can click on in the select1 appearance="xxforms:tree control are rendered as links, so users know that this is something they can click on to make a selection. I assume that you don't want them to show as links because the tree might be "read-only" in your case (for information only, not to make a selection). This isn' supported at this point. As a workaround, you could use CSS to change the pointer and appearance of links in the tree so to users they don't even notice that this those are links.
About the menu appearance — It works very much like the tree appearance. See for instance this example using the menu.

Resources