Conditional firing of events using JavaScript

Coding, Technology

You have beautifully built a grid in your web application and not only this you have given custom features in your grid that have the ability to add and delete the dynamic data, to test the same you refresh the page and the loading starts, as the page is loaded you cross your fingers and press the delete button, you wear a clueless expression as nothing happens, the grid is unaltered.

Naturally such a condition is baffling for any developer, you immediately start to hold the button as the culprit and you take the usual route of checking the ID of the button etc, but the solution just doesn’t reveal itself.


Well the solution isn’t simple as it seems, at times even after the page load the element fails to bind itself with the Grid or it takes more time than usual, in such a situation we make use of the Set time out function.

The set time out function holds the on click event until a condition is completed, in our context until the data is successfully loaded in the Grid the delete button will not function.

We can also customize the button by explicitly mentioning a time interval that is the event will only fire after the explicitly mentioned amount of time.



, , , , ,
Previous Post
The Untapped Market of Social Sector and the Fortune it Holds for Future Entrepreneurs
Next Post
The difference between a Mediocre and an Excellent Business Analyst