Fire getData when click on button NOT when key pressed on filters - angularjs

I am looking for a way of stopping the getData function to trigger when I am typing on the text boxes and instead I want to fire it at will when I click on a button. Does someone know a way to accomplish this?
I know there is a question for this already here , but noone has replied yet and getting an answer would allow to close both the old one and mine.
AngularJs ng-Table stop getData function when filtering
Thanks in advance!

Related

Showing modal just before component unmounts in React.js

It is a question about strategy you would take. Mu issue concerns showing modal in a right moment, ie. when user uses a form and wants to go out of the form (which is component of course) by clicking any other link visible on the page I would like to show him something like: 'you're about to leave a page, are you sure to do that?' and buttons yes/no below it. So my first approach was to fire modal on componentWillUnmount lifecycle, but is seems that I cannot call it there as it won't accept any logic of deciding to leave or stay on the page (it will quit anyway). Also I cannot set state there and basing on that show modal. Maybe one of you had the issue?
Sorry for not copying the code here but it is way too long ;)
Thank you!
componentWillUnmount will never go backwards, you'll need to use the componentDidMount hook to use the functionality.
You may call an event handler on which you may also redirect to after the user confirms.
See this example: Detecting user leaving page

How to allow/stop an event based on a condition like YES or NO?

I need to allow or stop an event from happening, based on a given condition such as a pop up box with options YES, NO and CANCEL.
I need to notify the user saying that there are unsaved data and if the user wishes to SAVE it, IGNORE it or CANCEL his current action(event such as Selection-change or Click).
I tried to use createInterceptor() function. But could not achieve the functionality.
Can anybody give me some suggestions with example? Basically I want to know how to stop an event.
Thanks..
Edited
I like the idea of using beforeXXX events. But I am still facing problems. As I mentioned, I need to ask the user if he wishes to save the unsaved data, which is a popup message box (With options YES, NO and CANCEL) that runs asynchronously. So by the time I get a reply, the event will have happened.
For ex. lets imagine a situation where, there is a page that displays a list of records in a grid with a pagination toolbar attached to it on the bottom(with a page size of 10 and total number pages is 10. So totally 100 records) on the left hand side. If you select a record in the list, the details are shown in a detail view on the right hand side.
Now,
I select third record in the list and make some changes to it in the detail view(form).
Without saving the record, I click on next page button on the Pagination toolbar.
It will show a confirm box from the beforeXXX event of Pagination toolbar, but the event will have happened anyway.
Here if the user clicks on CANCEL, I will have to restore the previous state which is already gone. Somehow I will have to go back and select the third record in the list of previous page.
So in order to resolve this problem, if I return false from my beforeXXX event, the next XXX event will be not be triggered.
But if the user clicks on YES or NO options I will have to trigger the event XXX manually which I am unable to do it for a selection-change event as of now.
Like this there can be many operations like list-filtering, searching, Ordering(A-Z/ Z-A), logout etc. For each of this operation I will have to write customised code which totally spoils the readability of the code.
So I was thinking if there is way to, somehow manually trigger the event XXX by holding the event object in beforeXXX...or is there any other way to restore the previous state.
Please give me suggestions....Thanks...
Many events have their "before-" counterpart, for example "beforeactivate". If you return false from this kind of the processing stops.
If not, or if your event does not have it's before- part, then you can use event object passed to all event handlers and call:
ev.stopEvent();
ev.stopPropagation();
return false;
at the end of your handler.

Form elements are not receiving input

I have a form designed with the GUI designer with input textfields and buttons. I have attached actions to the buttons. When I call up the form with showForm(Form,null), the textfields are not accepting input and the buttons are not triggering the action. This is happening only for this form. Initially, there was the problem solved here Unable to call a specific form from a button in codenameone and then the problem solved here Simulator keeps defaulting to old Main form. What could be the issue now?
As far as I know there may be some issues as you say, but first need to see code
In the form after you added the text fields did you select the text field component and press action event?
Assuming you did that you should get a callback method in the Statemachine class.
This call will be invoked only when the user changes the content of the text field. You can run in the debugger and set breakpoints/step into code to see what is going on.

Any way To disable The next and Last Button Of PagingTollbar?

I'am Using pagination in my grid.The grid store have no data but in pagination toolbar the
next and last button is enable .What is the reason for that? I can't Understand it.
Any One Please Help me.
You can manage it. see answers of similar questions.
Also, you can enable/disable it by using methods of DOM elements, on afterRender function.

How to catch/handle the window form's hidden/showed events?

In my application I call App.Current.MainWindow.Show()/App.Current.MainWindow.Hide() to show/hide my application but I don't know how to catch the event when the form is hidden/showed. Please help if you know how to!
One of your tags is WPF and the other is WinForms... I'm better with WinForms, so I'll answer for that tag.
The Form.Shown event documentation is here with sample code...
There is no corresponding Form.Hidden event. The best you can do is choose from Form.Closing or Form.Closed or one of the other events.
Added from my comment above
Question - if you're CALLING the Hide and Show in your code, why do you need to capture the events? You already KNOW when it's happening. If you want to run some code inside the form after hiding and closing it, expose the code as a public function, and call the function after showing and hiding the form...

Resources