HomeActive Query Builder - HowTos and TroubleshootingActive Query Builder ASP.NET EditionHow to handle events on the client side using JavaScript?

3.7. How to handle events on the client side using JavaScript?

There is the "Client event handle" demo project that included in the installation package to illustrate this functionality.

Below is the sample code from this demo:

	<script type="text/javascript" language="javascript">
		OnApplicationReady(function () {
			$(QB.Web.Application).bind(QB.Web.ApplicationEvents.beforeDataExchange, beforeDataExchange);
			$(QB.Web.Application).bind(QB.Web.ApplicationEvents.afterDataExchange, afterDataExchange);
		});

		function beforeDataExchange(sender, e) {
			alert("Before data exchange");
		}

		function afterDataExchange(sender, e) {
			console.log(sender, e);
			alert("After data exchange");
			if (e.SQL) alert("New SQL:" + e.SQL);
		}
	</script>

Related Pages
This page was: Helpful | Not Helpful