Using emit to trigger an EnhancedGrid event - javascript

It seems there is a bug in the dojox.grid.EnhancedGrid. The "onApplyCellEdit" is not triggered on editing a cell and then clicking Ok button in IE browser. Here is a jsfiddle,
http://jsfiddle.net/eZVkA/3/
As you can see, when you edit the cells in second column and then click on the button (without pressing enter or clicking on the grid), the "onApplyCellEdit" is triggered in all the browsers except IE. I presume this is a bug.
I am trying to resolve this by using emit function but not sure how to use it properly. I wish to use emit on click event of the button and trigger the "onApplyCellEdit" of the EnhancedGrid.
Any solutions?

You do not need emit but it is a good function to learn though.
http://dojotoolkit.org/reference-guide/1.9/dojo/on.html
by calling grid.edit.apply(); it will trigger the event. Grid is referring to the widget itself.

Related

React onClick event suppressed while dropdown is open

I have created a codesandbox to demonstrate the problem:
https://codesandbox.io/s/cocky-wu-mibxl
For some reason the onClick event handler on the link that comes after the dropdown, is not triggered while the dropdown is open and I have no idea why. I hope you can help me out here.
mousedown event happens a lot before the click / mouseup usually (>50ms) and in this case the dom has changed and the element that you clicked is not in the place where you started the clicking (mousedown) and does not receive the click event. You could add a timeout to the useOnClickOutside cb call but that is very unreliable.
Javascript is a single threaded language. So to get the <Dropdown> list to close, you need to close the alert() box first. The closest you will get is the work around in the comments, or you can change the action of clicking the link to OnMouseUp rather than OnClick. Either way, you will still need to close the alert box for execution to continue.

Reload the page if i click on outside the multiple dropdown box using javascript

I have a small query, I have a multiple dropdown box in my form. after selecting multiple value, if I click on outside the multiple drop down box page should reload. How can I make it happen using javascript. I have used "onmouseout(reload.form)" option but it is not working. Please help me on this.
Thanks
Ranjith
In this scenario, you might need click event rather mouseout(which is not on click but when mouse loses the focus).
For more details about click outside the element refer the below link
Javascript Detect Click event outside of div
So once you capture the click out event, you can just trigger the page load using
window.location.reload(true) or window.location.reload(false)
true or false depends on you need to load from cache or server.
Hope it helps!!
Seems like you should really connect to the change() signal on the select box instead. By depending on the mouse event, you will prevent people form using your form with the keyboard only, for instance. onmouseout will also not work on mobile devices

How to solve vmouseup being interrupted

I'm using jQuery Mobile to develop one single page to use in Android Webview.
There is an button which I need put some pressed effect, and then I use vmousedown to add press style class and vmouseup to remove the class added before. However, there are something interrupt the vmouseup process.
Reproduce:
First, press one button, and it trigger the vmousedown event.
Then, keep hold your finger and move outside the trigger area.
Finally, loosen your finger and you will see it keeps the state that you hold it.
I have done a demo to test, and find that it even won't trigger vmouseout or vmousecancel, the last event have been triggered is vmousedown.
Is there anyone know why this happen and how to solve this?
This is code : Fiddle
When I written an example to test gesture event, I noticed that, the taphold event will be triggered and then I put it in on method and this problem fixed.

Detect right click delete/cut/copy tinymce

How can I detect right click delete on tinymce ? I detected the paste event by the onPaste event, but I am stuck on the cut delete and copy. I know that there is the event onContextMenu but there doesn't seem to be a function or variable that holds the menu items.
Any help please ?
I assume by "right click delete" you mean selecting delete from the dropdown browser right click menu. Problem here is that there is no adequate event being fired in the tinymce iframe. The only thing which comes to my mind is the event onNodeChange. This should get fired, but this one gets fired on several kind of other tasks too.
Another (not easy) option is to develop an own BrowserAddOn which can listen for a browser intern event and then do its magic.

Internet Explorer Fires Change Events On Keypress

IE fires the change event on a select menu when using the arrows to navigate the menu. This is not the case in non-IE browsers. Non-IE browsers only fire the event when clicking on the option, or pressing enter after navigating to the item with the arrows. Is there a way program around this? I need the event to not fire when navigating with the keys.
I would add my own change event listener and handle things that way if I could. Without knowing all of the details it's hard to say but I'd look there first because the event cannot be cancelled. Outside of that approach, IE is going to fire the event when the value changes so not much you can do about that. Here is a link to the change/onchange in IE. It actually says this in the doc.
To invoke this event, do one of the following:
Choose a different option in a select object using mouse or keyboard navigation.
Alter text in the text area and then navigate out of the object.
It stinks but one of those you have to account for when using a select field.
The solution that worked for my situation was the following.
bind to the blur event instead of the change event.
This introduced another issue, where when I initially load the page the select fires a change event, and I need the code in my blur binding to take effect. Binding to change and having it trigger blur caused massive recursion. The solution was to create an init function that ran at startup.
initData : function(){
var t = this,
formSelects = 'select';
jQuery.each(formSelects, function(){
// do my code here that normally happens in blur.
})
}

Categories

Resources