Karim,
So in your widget.js you had one of your requires out of order with your vars (very common AMD programming error). You also has an extra comma in your require list and I added some code to your events "this.own" that tell the module to destroy the event handlers when the module is destroyed.
/////////////////////////////////////////////////////////////////////////// // Copyright c 2014 Esri. All Rights Reserved. // // Licensed under the Apache License Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /////////////////////////////////////////////////////////////////////////// define([ 'dojo/_base/declare', 'jimu/BaseWidget', 'dojo/_base/html', 'dojo/on', 'esri/toolbars/navigation', 'jimu/utils', 'jimu/portalUtils', 'dojo/dom-style', 'dijit/Toolbar', 'dijit/form/Button', 'dojo/domReady!' ], function ( declare, BaseWidget, html, on, Navigation, utils, PortalUtils, domStyle ) { var clazz = declare([BaseWidget], { name: 'NavigationToolbar', baseClass: 'jimu-widget-navigationtoolbar', startup: function () { this.inherited(arguments); var navToolbar; /*var element = document.createElement("input"); //Assign different attributes to the element. element.type = "Button"; element.value = "zoom in"; //element.class = "zoominIcon"; element.name = "kimo"; // And the name too? element.onclick = function () { // Note this is a function alert("blabla"); }; html.place(element, this.domNode);*/ navToolbar = new Navigation(this.map); this.own(on(navToolbar, "extent-history-change", extentHistoryChangeHandler)); this.own(on(document.getElementById("zoomin"), "click", function () { navToolbar.activate(Navigation.ZOOM_IN); })); this.own(on(document.getElementById("zoomout"), "click", function () { navToolbar.activate(Navigation.ZOOM_OUT); })); this.own(on(document.getElementById("zoomfullext"), "click", function () { navToolbar.zoomToFullExtent(); })); this.own(on(document.getElementById("zoomprev"), "click", function () { navToolbar.zoomToPrevExtent(); })); this.own(on(document.getElementById("zoomnext"), "click", function () { navToolbar.zoomToNextExtent(); })); this.own(on(document.getElementById("pan"), "click", function () { navToolbar.activate(Navigation.PAN); })); this.own(on(document.getElementById("deactivate"), "click", function () { navToolbar.deactivate(); })); function extentHistoryChangeHandler() { document.getElementById("zoomprev").disabled = navToolbar.isFirstExtent(); document.getElementById("zoomnext").disabled = navToolbar.isLastExtent(); } } }); clazz.inPanel = false; clazz.hasUIFile = true; return clazz; });
no i don't use mid and widget successfully created because it appear on screen
There is that uncaught type error. Do you use "mid" in your widgets code? Is your widget listed in those that were successfully created?
not say any thing every thing is right
What does your web console in your web browser say? You need to provide more info in your post if anyone is going to be able to help.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.