Closing Tooltip when new one is opened - primefaces

I am looking for a possibilty to make a tooltip close automatically when a new one is opened. I am using Primefaces 6.1.
<p:tooltip for="clientName" showEffect="clip" hideEvent="dblclick"
position="bottom">
At the moment it works like this: Mouseover on a label from my datatable and the tooltip opens. When I double click on the label which opened it, the tooltip disappears. But the problem is that I can accidently open like 30 tooltips at the time, just by moving over several datatable entrys.
Short: I only want a single tooltip to be opened at the time. But I dont want the tooltip to close by an MouseLeave event.
Im happy for any suggestions. Thanks.

Use the onShow or onBeforeShow attribute of the tooltip which is according to the PrimeFaces documentation (page 542 on in the 6.1 docs)
onShow
Client side callback to execute after tooltip is shown.
beforeShow
Client side callback to execute before tooltip is shown.
Returning false will prevent display.
In that you can call any javascript (jquery) to hide all other tooltips.
But why not use a showDelay of e.g. 500 ms instead of the defaul 150?

Related

How can I get an empty link "clicked" programmatically in React.js?

I am not sure if this is exactly what I need, so I'll explain my situation
I am using CSS to show a popup window by using the :target state to set the visibility and opacity of it correctly.
On the popup I have an X that sets a new empty target when clicked, this closes the popup as it is not the target anymore.
This is my X link:
<a href="#" className="project-form__close">
✖
</a>
My problem is this - the popup is actually a form, and I'd like it to close automatically when the form submits, without the user actually having to click anything.
How can I do that? I'm not actually navigating anywhere.
Two choices:
Call the .click() method on the link, to simulate a click
Just do window.location.hash = ''; to perform the same effect directly

modal window to open when icon is clicked

I have a couple of form definitions in my main HTML file.
I would like to display these forms in a modal window, when the user performs certain action, such as click on an icon.
I have followed an article on how to do it for links (hrefs). But now my requirement is to get the same working for clicking on an icon.
Thank you,
Harriet
The answer is to write a java function, that will explicitly set the location of the window to where you want the url to point - example:
function openPreferences() {
window.location = '#openPreferences';
}
I think the most simple solution would be to create a LinkBlock Element and set the Background to the Icon's Image, which will allow you to turn it into a Link, thus further allowing you to open your Modal Window with it.. Simply create your Modal as Display None, and upon clicking the LinkBlock (with your Icon as the Background), make it change the Modal property to Display Block, etc.

KendoGrid popup edit window, Form field set focus using jquery

Context: kendoGrid with editing set to popup. Opens a popup Window with fields in it, in this case the template for the editing window is custom with JS logic etc. The tabindex values have been set for all the fields in the order we want and autofocus set on the first field. I have custom JS that runs on the Edit event of the grid to position and size the window when it pops open: function editWindowLocation(e)
Observation: This is relatively simple with JS code if the Form and the Fields are static doing something like: document.formName.fieldName.focus();
Problem: After the window pops open, the new window has focus. When the tab key is pressed, it then sends focus to the buttons on the window (Update/Cancel) more tabbing later, it reaches the fields. How do I get the first field in the popup window to focus, so tabbing will set focus to the other fields in the order their index is set?
Solution: At the end of function editWindowLocation(e) I added a little bit of code to find the first tabindex and set focus to it.
setTimeout(function () {
$("input[tabindex=1]").focus();
}, 1000);
Why a timeout you say? The kendoWindow is somehow overriding the .focus() event and placing the focus on the div that makes the kendoWindow. But when done in a timeout, it works as expected. Not sure why this happens, but this worked for me.
Hope this helps people with similar issues.

checkbox button requires multiple clicks

Anyone with firefox browser can you open up this fiddle.
The issue I have is with this checkbox button I have, it requires multiple clicks to turn it off and my question is how can I stop this from happening? I know its the posistion:relative which is causing this but I need this so that every time I click on a button, it does not go to the top of the page. I just want the button to turn on and off in one click, not multiple clicks
(See comments below the question - now I know what happens to you)
Ahhh - you cannot solve this without Javascript: quick (double?) click on the TEXT ITSELF is interpreted as "select text" by the browser, and it does not send the event to the checkbox when that happens. With Javascript you can force "un-select" of the text on click.
Click "slowly" - avoiding double click text selection - and it will work (just to show the cause of the problem, no solution without Javascript or proprietary CSS).
Try adding this: Prevent text selection after double click
Maybe you should use a full Javascript Checkbox-Button solution instead of trying to accomplish it with just CSS.

Catching event when a link is clicked in a Textbox displaying richtext

In Microsoft Access 2007 the Textbox can be set to display a cut-down version of HTML as richtext.
However, there does not seem to be an easy way to detect what has been clicked within the box itself.
For instance, you can display a classic HTML <a> tag that appears as a link but clicking it doesn't generate any event.
I'd like to know what has been clicked, somehow.
Any idea?
I don't have A2007 to test this, but if clicking the link sets the cursor position, you could check the rich text control's .SelStart property (while it has the focus), but I don't know what event you'd use to trap this. OnEnter and OnGotFocus seem to be too early, and OnChange won't fire just for clicking a link, but the control's OnClick event might do the trick.
If so, you'd have to parse forward and back from the selection point to figure out if you're in a hyperlink, and I'm not sure exactly how that works in the A2007 richtext control.
Sorry I can't be of more help, .OnClick combined with .SelText might work if the click on a hyperlink sets the cursor position within the clicked hyperlink.