Last active
April 11, 2016 01:45
-
-
Save jbratu/04e5d756a552ad0c4032b001f81b4861 to your computer and use it in GitHub Desktop.
Example jQuery plugin for OpenInsight O4W
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CASE EVENT _EQC "CREATE" | |
//Include the plugin for use in this routine | |
O4WScript("/o4w/plugins/sayhello/jquery.sayhello.js") | |
O4WForm() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Subroutine O4W_CS_TEST_DIALOG_HELLO_WORLD(CtrlEntId, Event, Request) | |
$Insert O4WEquates | |
$Insert O4WCommon | |
BEGIN Case | |
CASE EVENT _EQC "CREATE" | |
//Include the plugin for use in this routine | |
O4WScript("/o4w/plugins/sayhello/jquery.sayhello.js") | |
O4WForm() | |
O4WHeader("Hello World Example") | |
O4WSectionStart("mainSection") | |
O4WText("Hello world example. Click the button to see the greeting.") | |
O4WBreak() | |
O4WButton("Hello World", "BTN_HELLO_WORLD") | |
O4WQualifyEvent("BTN_HELLO_WORLD", "CLICK") | |
//Bind the sayhello plugin to the button | |
O4WPlugin("BTN_HELLO_WORLD", "sayhello", "") | |
O4WSectionEnd("mainSection") | |
O4WSectionStart('DialogSection') | |
O4WSectionEnd('DialogSection') | |
CASE EVENT _EQC "CLICK" | |
Begin Case | |
Case ctrlentid _eqc 'BTN_HELLO_WORLD' | |
O4WSectionStart('DialogSection', O4WResponseOptions()) | |
O4WText("Nice to meet you.") | |
O4WBreak() | |
O4WButton('OK','DIALOG_OK_BTN') | |
O4WQualifyeVENT('DIALOG_OK_BTN','CLICK') ; | |
O4WSectionEnd('DialogSection') | |
O4WDialog('DialogSection', 'Hello World') | |
Case ctrlentid _eqc 'DIALOG_OK_BTN' | |
O4WDialog('DialogSection') | |
End Case | |
END Case | |
RETURN 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function( $ ) { | |
//Add custom function to the jQuery object that represents out plugin code | |
$.fn.sayhello = function() { | |
//Add a click event function to the object the plugin was bound to | |
this.on('click', function() { | |
alert('heya from the plugin'); | |
}); | |
}; | |
}( jQuery )); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment