Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding dojo widget inside custom widget

I am making a small dojo widget, basically extending the dailog widget and want to add simple widgets like a text input a few labels etc. How do i go about this? I am following a tutorial,

Dojo how to make a widget

Please help me out.

Thanks

like image 913
Aadi Droid Avatar asked Jul 26 '26 10:07

Aadi Droid


1 Answers

First. I'am not good at english, but will do at my best.

This is the path of my widget.

enter image description here

Here. The important code in the js file that must declare.

dojo.provide("gissoft.dijit.widgetOam"); 

dojo.require("dojo.parser");
dojo.require("dijit._Widget");
dojo.require("dijit._Templated");

dojo.declare("gissoft.dijit.widgetOam", [dijit._Widget, dijit._Templated], {
    widgetsInTemplate: true,
    basePath: dojo.moduleUrl("gissoft.dijit"),
    templatePath: dojo.moduleUrl("gissoft.dijit", "templates/widgetOam.html"),

    constructor: function () {

    },

    postMixInProperties: function () { 

    },

    postCreate: function () {

    },

    startup: function () {

    }

});

And in file widgetOam.html(templatePath)

<div> <!-- do not add tag <html> , <head> , <body> but must have <div> first -->
    Hello World.
</div>

And this is how to call widget from my Default.aspx

You must add this before you call the dojo library

<script>
   djConfig = {
       parseOnLoad: true,
       baseUrl: './',
       modulePaths: { 'gissoft.dijit': 'js/gissoft/dijit' }
   };
</script>

And in the body

<body class="tundra">
    <form id="form1" runat="server">
    <div>
        <div data-dojo-type="gissoft.dijit.widgetOam"></div>
    </div>
    </form>
</body>
like image 114
OammieR Avatar answered Jul 28 '26 23:07

OammieR



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!