Simple Dialog widget factory question
Trying to create a custom Dialog extension using the widget factory and jquery UI 1.10.4 This snippet illustrates the problem. I want to set up a "Close" button automatically. However, I can't seem to make it work. The snippet below is as close as I've come thus far, and it crashes in the jquery-ui script on the first line of the dialog widget's _create method.
I have tried adding my own _create method and calling _super() but that also didn't work.
- <button id="btnTestDlg" >Test the dialog</button>
- <div id="dialogDiv" title="WooHoo! Test Me Baby!" style="background: blue;">
- </div>
- <script type="text/javascript">
- $.widget("EZ.testDialog", $.ui.dialog, {
- options: {
- autoOpen: false,
- buttons: [
- {
- self: this,
- text: "Cancel",
- icons: { primary: "ui-icon-cancel" },
- click: function () {
- $(self).testDialog().testDialog("close");
- }
- }
- ],
- }
- });
- $(document).ready(function () {
- $('#dialogDiv').testDialog({
- width: 700, // these options are same as Jquery UI Dialog
- height: 520,
- modal: true,
- show: {
- effect: "slide",
- duration: 400
- },
- hide: {
- effect: "slide",
- duration: 400
- },
- });
- $('#btnTestDlg').click(function() {
- $('#dialogDiv').testDialog("open");
- });
- });
- </script>