Primeng dropdown firing onBlur event - primeng

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.

Related

React-Admin: Is there an event which is triggered when a list/datagrid item is selected?

I'm looking for the event which displays the bulkaction-toolbar (the "xx items selected reset view-button delete-button"-toolbar) when a list/datagrid-item is selected. Here is an gif-example: bulkaction-toolbar
the following event is fired when the 'select-all' checkbox is clicked by the user
<Datagrid onSelect={arr=> console.debug('datagrid->onselect:', arr)}>
additional question: if I use this event like above the checkbox is never checked when the user clicked on it. Is this a bug or how i make working it?

React Fire on Change event on load

I have a component that dynamically builds check boxes, from the result of an API call.
I am selecting the first radio button in a group, as a default, when the component is created.
Based on what radio button is checked/selected the page displays differently. So the radio button is selected after the page loads, but the onChange function does not get fired to display the page correctly. I am looking for a way to fire the onChange event after loading, API fetch, and displaying the radio buttons.
Thanks you helped me figure it out. In the final line of my useEffect hook, I click the first radio button in the group. That both sets the default and fires the change event. I tried setting it to check but that did not fire the change event.
useEffect(() => {
.
.
document.getElementsByName('rbImageGroup')[1].click();
}, []);

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.

Redux-form - onChange on form not firing

I have problem with using redux-form as a server filter. Purpose of the form is on every field change send request to server with actual form values for filtering data in table.
I tried to do it with onChange event attached to "form", then in onChanged event is handleSubmit called. It works until i used it with my custom Field component.
When onChanged is used with custom component, then form onChange event is not fired. It is fired only when is normal field "input" edited.
Is this bug? Are there another ways to submit form after any field change is done? I tried to do it with formValueSelector but comparing values of form every rerender is not optimal.
Example is here https://codesandbox.io/s/98z3kjk12y
The problem is in custom component, namely that it is div - not an element that have onchange event. Honestly, it was something new for me that form has onChange event, but it seems it is fired when any form's child element with onchange event is triggered.
If you try to replace in MyStrangeInput div element with, for example <input type="text"> onFormChange will fired.
As a very, very, very dirty workaround you can customize checkbox with button styles so onFormChange will fired(because checkbox onchange event).
Unfortunately(or fortunately?) redux-form doesn't have handleChange props, so as i see the most clear solution here will be to call onFormChange on each form's field change.
Updated example

how to stop blur event on calling reset of textfield

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.

Resources