I have create a Grid Application with a modal form linked to it for editing purposes.
This code works in onApplicationInit, but not in onScriptInit:
?>
<script src="<?php echo sc_url_library(‘prj’, ‘mylib’, ‘libfile.js’); ?>" /></script>
<script>$(document).ready(function() {myfunction();});</script>
<?
Function defined in project library (mylib / libfile.js):
function myfunction() {
$(‘body’).on(‘click’, ‘.classtobind’, function(e) {
// Do something here
});
}
When the grid refreshes (modal linked form returns on Save), the event bound to the body (and the JS library file) is lost. I am trying to add the library back and rebind to the body. It seems as if only the onScriptInit and onHeader events fire on grid refresh.
Any suggestions on how to accomplish this?