rich:panelMenu deselect - jsf-2

Here's the situation:
I have two code>rich:PanelMenu on the same page menuA and menuB.
When I click an item on menuA the item is selected, fine. Now if I click on a item on menuB the item on menuB is selected, but obviously the selection on menuA is still active.
The question is: How i reset the selection on menuA?

ok, found it! I was looking for menuA.selectedChild("") but now apparently is setValue(), so menuA.setValue("") will do the trick.

Related

Drag and Drop: by using copyArrayItem() the dragged item should not be removed from start array while drop Angular 8

I have a list of items from where I drag an item and drop it into another list. I'm using copyArrayItem() method from Angular to not remove the item from the previous array.
I start dragging, the item is within the previous array: the placeholder from that item shows up.
Start dragging, placeholder shows up
I'm leaving the previous array: the placeholder/dragged item disappears (I want that the placeholder/dragged item stays) -> the start array has minus 1 items.
Placeholder disappears, what I don't want
I'm on the target array: a placeholder appears in a target array.
I'm dropping the item: item appears now in the start and target array.
After more research I've found an open issue about that problem:
https://github.com/angular/components/issues/13906
and there I've found suggestions from participants:
https://stackblitz.com/edit/angular-krmecd?file=src%2Fapp%2Fapp.component.ts
This example with workaround helped me to solve this problem:
https://stackblitz.com/edit/angular-o8exzv-jauhhi?file=src%2Fapp%2Fcdk-drag-drop-connected-sorting-example.html
Maybe this information will be useful for someone.

How to remove an item from a paper-listbox?

I can add an item to a paper-listbox with
Polymer.dom($['mylistbox']).append(paperItem);
However I'm having trouble deleting it from the list afterwards. I tried:
paperItem.remove();
That initially makes it dissapear, but it appears again after selecting another item in the list. How do I remove a paper-item from a listbox?
Polymer.dom($['mylistbox']).removeChild(paperItem);

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);

tagcompletion like stackoverflow

Working example
Bug
add an item that exists in the list
add an item that doesn't exist in the list
add an item that exists in the list by clicking arrow key or clicking an item with mouse
notice that all items are erased and everything starts over.
I am building this on top of a solution provided to me in another question. I've taken the code from that example and modified to my needs. however, now I am having the issue stated above.
What can I do to avoid having the list erase all items when a new item is added by clicking down arrow key after a non existent item is added.
Add the following to the options object you pass the autocomplete widget:
focus: function() { return false; }
From the docs on focus:
Canceling this event prevents the
value from being updated, but does not
prevent the menu item from being
focused.
Here's your example without the bug: http://jsbin.com/oquda3/4

How do I move multiple nodes at once in a TJvTreeView?

When you select multiple nodes of a JvTreeView, and then try to drag these nodes, the JvTreeView selects the node you clicked to drag, rather than initiating dragging all the selected nodes. You end up dragging only this single node.
Is it possible to drag multiple nodes in a JvTreeView? I am using Delphi 2007.
UPDATE: Oddly enough, if I hold down CTRL+SHIFT when dragging the items, I can successfully drag them all. Any ideas?
Suppose MultiSelectStyle is the default [msControlSelect], then the answer to your question is 'you don't release the control key when you're selecting the last item and beginning dragging'.
The culprit is in TJvTreeView.WMLButtonDown in JvComCtrls.pas. Code there tests if 'Ctrl' is pressed when the TreeView is MultiSelect, and clears all items and selects the clicked item if 'Ctrl' is not pressed. It should instead test if the clicked item is already selected and do nothing if it is.
You can see the broken behavior without dragging. Multi select a few items and then click a selected item with the mouse. The VCL TreeView do not select or de-select anything, while the JVTreeView, instead, de-selects all items and selects the clicked one.
Yes absolutely, I do it all the time.
Of course Multi-Select needs to be True and you may need to have a look at the TTreeView's MultiSelectStyle. That controls what type of nodes can be selected at the same time. For example if msSiblingOnly is set to true, you can only select sibblings.
Are you using dmAutomatic or dmManual. If the latter, it could be that you are doing something in the OnMouse* events that is negating the multi-selection you made earlier.

Resources