how to stop blur event on calling reset of textfield - extjs

It appears that on calling reset event of textfield in ExtJS 4.2 the blur event is automatically called.
i have a scenario where in a form i have combo box and textfield, on select of combo box i am calling reset of textfield.
#cmbStatus : {
select : function(combo, records, eOpts){
combo.up('form').down('textfield[name=referencenumber]').reset();
}
and on blur of textfield i am calling reset of combo box.
#txtRefNumber : {
blur : function(cmp, The, eOpts){
cmp.up('form').down('combobox').reset();
}
}
here, because of the cascading effect on select of combo box, since reset is being called, the textfield blur event is automatically called and combo box reset event occurs
Is there any way i can stop the textfield blur event ?
I am aware about the suspendEvent method of textfield but no use as it will suspend the event till resumeEvent is called.
Thanks

The blur event is not fired as a direct result of calling reset but as a response to moving focus out of the text field.
You will probably need to reconsider and redesign the logic so that the event loop does not occur. Try to use a different event, for example change.
Also, calling suspendEvents might be necessary to avoid the event loop, depending on the logic you need.

Related

Primeng dropdown firing onBlur event

I need to fire onBlur event for p-dropdown. I need this to be fired only when the dropdown looses focus. But its firing onBlur event even when I click on dropdown. I know there is 'onSelect' event but I cant use that.
My requirement is, User can either select a dropdown value or can enter any text which is not in dropdown. I need to save the info into DB.
I tried putting a settime but its not working out.

How to prevent text selection in an ExtJS grid cell from firing the onclick event handler and have the grid row (de-)selected as a result

In ExtJS 6.2.0. I have a standard grid. In some of the grid cells I have text that a user is able to select (for copy-paste purposes).
However, upon selection of that text (through mousedown-mouseup), also the onclick event handler of that row is fired, causing in my case the (de-)selection of that grid row.
I am looking for a way to make these text selections, but without triggering the onclick event handler.
I was thinking along the line of killing the default single click event listener, and introducing a dedicated double click event listener, but that route hasn't led to a simple solution so far.
Any suggestions?
I suggest change selectionModel to Ext.selection.CheckboxModel and set enableTextSelection in viewConfig.
selModel: {
type: 'checkboxmodel',
checkOnly: true
},
viewConfig: {
enableTextSelection: true
}
Example : https://fiddle.sencha.com/#fiddle/35o5

In onMenuClose or onBlur event of react-select identify whether event is triggered by option selection or the blur

In react select onBlur event or onMenuClose event is triggered when user selects the option or blur (click outside of the control).
So I want to perform the business logic on blur event if user has not selected an option.
In other words I want to know how blur event is triggered.
onBlur event is triggered when the focusable HTML Element loses focus. Maybe it's easiest to see if select option was changed? Don't know how your implementation looks though but maybe this will help you.

How to cancel event of spinner field in ExtJS 4.1?

I am developing application using ExtJS 4.1. I have one spinner field and I want to change value of that method programatically. I have set up listeners like change, spinup and spindown for this same spinner field.
Now I would like to know how to prevent listener method of these events getting fired only when I change the value of spinner field through my program?
For example,
var mySpinner = Ext.ComponentQuery.query('#foopanel > #mySpinner')[0];
mySpinner.setValue(2000);
When mySpinner.setValue(2000); line is executed, change event of mySpinner gets fired and as I have listener method for this change event, that listener method is executed.
Is it possible to prevent invocation of change event listener method?
Thanks..
You could suspend all events by calling
mySpinner.suspendEvents();
mySpinner.setValue(2000);
mySpinner.resumeEvents();
That would be the cleanest an easiest way IMO
And that's also a usecase why this methods exist

Backbone.ModelBinder: why do I have to hit submit twice?

I am using Backbone and Backbone.ModelBinder.
I have a bunch of text fields that are bound via BackboneModelBinder. Everything works as expected however when I make a change to a text field and I don't unfocus the field first (click off the input field) before hitting the SAVE button, I have to hit the Save button twice -- once to unfocus the fields, and then a second time to actually fire the save button handler (which should have fired the first time)
(Save is a standard html button with a backbone event bound to it).
Does anyone have any knowledge of why this might be?
I hope this made sense :|
Thanks for any help or direction
-Kirk
That's because ModelBinder by default set the new value to the model's attributes on "blur" or "change" events (it dependes on the input's type). You can modify this behavior by changing the source code, adding keyup as binding event in those two methods:
_bindViewToModel:function () {
$(this._rootEl).delegate('', 'change keyup', this._onElChanged);
// The change event doesn't work properly for contenteditable elements - but blur does
$(this._rootEl).delegate('[contenteditable]', 'blur keyup', this._onElChanged);
},
_unbindViewToModel: function(){
if(this._rootEl){
$(this._rootEl).undelegate('', 'change keyup', this._onElChanged);
$(this._rootEl).undelegate('[contenteditable]', 'blur keyup', this._onElChanged);
}
},

Resources