Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

javascript - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...