Extend an existing widget

718
4
Jump to solution
09-30-2021 09:33 AM
GuillaumeArnaud
Occasional Contributor

Hi,

I create a widget to find an adress with french ign service geocoder.

It help to write a correct adress or, from a click, it give the adress.

GuillaumeArnaud_0-1633019268217.png

I need to use it to find what is near on different app with some specific information. I hope not cut and paste the simple widget and add specific stuff but i would like to add it in a place and get its result. I try to do it in dojo but it didn't work :

widget.js

define([
'dijit/_WidgetsInTemplateMixin', 'dijit/_AttachMixin','jimu/BaseWidget','../CD82_IGNRechercheAdresse/Widget'
'../'
], function (
_WidgetsInTemplateMixin, _AttachMixin, BaseWidget, CD82_IGNRechercheAdresse

) {
return declare([BaseWidget, _WidgetsInTemplateMixin, _AttachMixin], {
//Création
postCreate: function () {
//Récupère les paramètres du formulaire
this.inherited(arguments);
},
//Démarrage
startup: function () {
let w = new CD82_IGNRechercheAdresse();
w.placeAt(this.placeRecherche)
}
});
});

widget.html

<div>
<div data-dojo-attach-point="placeRecherche">
</div>
<div data-dojo-attach-point="SpecificZone">
</div>
</div>

How can I do this ?

Thanks

Tags (2)
1 Solution

Accepted Solutions
GuillaumeArnaud
Occasional Contributor

Hi,

Yes. I put all basics functions in jimu.js in a personnal folder. I must copy it every time I update wab :

GuillaumeArnaud_0-1637244715271.png

Then I call it in the specifics widget like this :

GuillaumeArnaud_1-1637244862017.pngGuillaumeArnaud_2-1637244916426.png

For the specific content of the feature, I put a widget in a subfolder to display the information :

GuillaumeArnaud_3-1637245235373.png

I specify it in config and I load it with require in widget :

GuillaumeArnaud_4-1637245286499.png

You can see the app here : https://lacarto.ledepartement82.fr/FranceServices/

GuillaumeArnaud_5-1637245490562.png

Search (right) is the first widget.

SidePanel is the second widget.

Red is in jimu.js/personnalfolder.

Blue is in the subfolder to display the information.

Yellow is also in another subfolder but works with attributes.

Great.

Guillaume.

View solution in original post

4 Replies
YauhenZaruba
New Contributor

Hey! Did you manage to complete the task?

0 Kudos
GuillaumeArnaud
Occasional Contributor

Hi,

Yes. I put all basics functions in jimu.js in a personnal folder. I must copy it every time I update wab :

GuillaumeArnaud_0-1637244715271.png

Then I call it in the specifics widget like this :

GuillaumeArnaud_1-1637244862017.pngGuillaumeArnaud_2-1637244916426.png

For the specific content of the feature, I put a widget in a subfolder to display the information :

GuillaumeArnaud_3-1637245235373.png

I specify it in config and I load it with require in widget :

GuillaumeArnaud_4-1637245286499.png

You can see the app here : https://lacarto.ledepartement82.fr/FranceServices/

GuillaumeArnaud_5-1637245490562.png

Search (right) is the first widget.

SidePanel is the second widget.

Red is in jimu.js/personnalfolder.

Blue is in the subfolder to display the information.

Yellow is also in another subfolder but works with attributes.

Great.

Guillaume.

YauhenZaruba
New Contributor

I look at the site, it turned out very cool !!! Can I borrow your code through devtools?

I just can't make a request to a third-party geocoder.

0 Kudos
GuillaumeArnaud
Occasional Contributor

Yes if you want. I use this geocodeur in the widget : https://geoservices.ign.fr/