Picon
Favicon

scoping conumdrum

Hello All,


I'm wrestling with a bit of a puzzle related to scoping in the code below.  Setting up the menu items and their onClick handlers works fine, but when I try to call the same showBasemap() method during postCreate() that the onClick uses, I'm unable to find the menu item.


Thanks for any help!


--john



define(["dojo/_base/declare","dijit/_WidgetBase", "dijit/_TemplatedMixin",  "dijit/_WidgetsInTemplateMixin", "dijit/_OnDijitClickMixin", "dijit/Toolbar", "dijit/form/Button", "dojo/_base/lang", "dojo/_base/array", "dijit/form/DropDownButton", "dijit/Menu", "dijit/ToolbarSeparator", "dijit/MenuItem", "dijit/CheckedMenuItem",  "dojo/text!./templates/BasemapToolbar.html"],

   function(declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _OnDijitClickMixin, Toolbar, Button, lang, array, DropDownButton, Menu, ToolbarSeparator, MenuItem, CheckedMenuItem, template ){

       return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _OnDijitClickMixin], {

           templateString: template,

           _basemaps: null,


           baseClass: "basemapToolbar",

           layerCollection: null,


           //constructor for parent called before constructor of child class

           constructor: function(arguments) {

               this.layerCollection = arguments.layerCollection;

               this._basemaps = this.layerCollection.basemaps;

           },


           showBasemap: function(selectedIndex) {

               //only one basemap showing at a time

               array.forEach(this._basemaps, function(basemap, idx) {

                   if (selectedIndex == idx) {

                       array.forEach(basemap.services, function(targetId){

                           this.layerCollection.getLayerById(targetId).setVisibility(true);

                           this.basemapMenu.getChildren()[idx].containerNode.style.fontWeight = "bold";

                       }, this);

                   } else {

                       array.forEach(basemap.services, function(targetId){

                           this.layerCollection.getLayerById(targetId).setVisibility(false);

                           this.basemapMenu.getChildren()[idx].containerNode.style.fontWeight = "normal";

                       }, this);

                   }

               }, this);

           },


           postCreate: function() {

               //add menu items to basemap menu

               array.forEach(this._basemaps, function(item, idx) {

                   this._addBasemapMenuItem(this.basemapMenu, item, idx, this);

                   if (item.default) {

                      //throws exception re: undefined menuItem

                      this.showBasemap(idx);

                   }

                }, this);

           },


           _addBasemapMenuItem: function(menu, item, idx, parent) {

               menu.addChild(new MenuItem({

                   label: item.label,

                   onClick: function() {

                       parent.showBasemap(idx);

                   }

               }));

           }

       });

   }

);

________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Michael Van Sickle | 18 May 2013 18:31
Picon

Testing dojo widgets using the command line

Hello,
 
I have been trying to find a way to setup unit tests for dojo module that allow me to inject testable mocks for a modules dependencies. It seems like you can do this in the browser test runner, but I couldn't find a simple way to do this using Rhino. To address this, I wrote the following module to decorate the global 'require' method with another one that allows mocks to be injected. Thoughts?
 
define([], function () {
    var reqOrig = require;

    var mocks = {};

    require = function (arr, callback) {

        var args = [],
            passThrough = [],
            passThroughIndices = [];
      

        for (var i = 0; i < arr.length; i++) {
            if (mocks[arr[i]]) {
                args[i] = mocks[arr[i]];
            } else {
                passThroughIndices.push(i);
                passThrough.push(arr[i]);
            }
        }

        reqOrig(passThrough, function () {
            for (var i = 0; i < arguments.length; i++) {
                args[passThroughIndices[i]] = arguments[i];
            }
        });

        callback.apply(null, args);
        
    };

    require.addMock = function (path, obj) {
        mocks[path] = obj;
    }

    require.removeMock = function (path) {
        mocks[path] = null;
    }

    require.clearMocks = function () {
        mocks = {};
    }

    require.toUrl = function () {
        return reqOrig.toUrl.apply(this, arguments);
    };

    require.toAbsMid = function () {
        return reqOrig.toAbsMid.apply(this, arguments);
    };

    require.undef = function () {
        return reqOrg.undef.apply(this, arguments);
    };

    require.log = function () {
        return reqOrg.log.apply(this, arguments);
    };

});
 
Bascially, it exposes three new methods (add, remove, and clear) that allows mocks to be manipulated. If a mock is not found, then the method defers to the original loader for a response. I'm sure that this isn't bullet proof since it is just a proof of concept right now, but I am wondering if any one else thinks that this is valuable (or if you know another way, I would be curious).
 
Thanks.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
sivakumaar | 18 May 2013 07:52

DOJO 1.9.0 RC2

HI everybody,

i am using dojo 1.9.0RC2 right now. In that dojox/app/tests folder(MVC
format) not working in android emulator device, after the built in phonegap
server. In phonegap server building successfully but if i run apk file in
device(emulator) means, the following error is coming.

Error: scriptError at file:///android_asset/www/small/dojo/dojo.js:15

What it mean ? and any mistake in example dojox/apps/tests folder? or its in
dojo.js? or something i made wrong ?

please suggess me.

thank you for advance helping me....

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/DOJO-1-9-0-RC2-tp3996628.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

hsn | 18 May 2013 04:28
Favicon
Gravatar

Custom animation class

Can someone provide basic example how to create custom animation class using
AMD loader dojo version?
I discovered on web just this, this seems to be for old dojo version.

http://ofps.oreilly.com/titles/9780596516482/animation_and_special_effects.html

http://stackoverflow.com/questions/16366566/how-to-create-custom-dojo-animation

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Custom-animation-class-tp3996627.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

mattmadhavan | 18 May 2013 03:34
Picon
Favicon

Gridx: resize call reloads and appends the data

Hello, 

I  have a Gridx control with Json rest store with a query.  I have couple of
issues. The Gridx only displays when resize is called on the Parent
container Widget. But when itzycalled, Gridx loads the same set of model
from the Server and appends to the Gridx. so instead of 4 rows as expected I 
see8 rows. 

can someone please explain what's going on? It's driving me a little crazy. 

Question. 

What's the relationship between the resize call and Gridx? I was under the
impression that I need to make this call only once on the top most widget! 
Why does a resize call on the Parent container Widget, makes the Gridx to
load the same set of data and append it? 

Thanks in advance 

Matt 

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Gridx-resize-call-reloads-and-appends-the-data-tp3996626.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Matthew Tyson | 18 May 2013 02:02
Picon

IE: required Cross Origin Resource Sharing

I switched to dojo 1.9 (from 1.8.3) and now when I try to load dojo from cdn on IE I get error for all modules, saying: required Cross Origin Resource Sharing.

Any ideas?
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
SnowCritter | 17 May 2013 21:42
Favicon

Parser not parsing in IE8+

I'm using Dojo 1.9 and have created an html file with the following code (it
is a "work in progress"):

/
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Benton County Sheriff's Office</title>

<link rel="stylesheet" href="js/lib/dijit/themes/tundra/tundra.css"
media="screen" />
<link rel="stylesheet" href="js/lib/dojo/resources/dojo.css" media="screen"
/>

<link rel="stylesheet" href="css/site.css" media="screen" />

</head>
<body class="tundra">

<div id="wrapper">
   <div id="borderContainer" data-dojo-type="dijit/layout/BorderContainer"
        data-dojo-props="design: 'headline', liveSplitters: true">

      <div id="header" data-dojo-type="dijit/layout/ContentPane"
           data-dojo-props="region: 'top'">
      </div>

      
      <div id="contentPane" data-dojo-type="dijit/layout/ContentPane"
           data-dojo-props="region: 'center'">

         <div id="tabContainer" data-dojo-type="dijit/layout/TabContainer"
              data-dojo-props="tabPosition: 'top'">

            <div class="informationPane" id="generalPane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'General'">
               General
               <br>

                     	 I.T. Help Desk <http://support>  

                     	 Email Server <http://136.234.66.60>  

                     	

                     	 Benton County Web Site <http://www.co.benton.mn.us>  

                     	 BCSO Policies and Procedures
<http://192.168.1.23/lexipol/Policy_Manual_RELEASE_10110818.pdf>  

                     	 DNR Fire Pager
<http://paging.acswireless.com/web_sendmsg.html>  

                     	 Benton County Intranet Site <http://136.234.66.29>  

                     	 Computer Usage Policy
<http://192.168.1.23/wiki/externalimages/PersonnelPolicies060209.pdf>  

                     	 BCSO Wiki <http://192.168.1.23/wiki/index.php>  

                     	 Lexipol Login <https://policy.lexipol.com>  

            </div>

            <div class="informationPane" id="phonePane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'Phone Info'">
                 Phone Info
            </div>

            <div class="informationPane" id="mapPane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'Maps'">
                 Maps
            </div>

            <div class="informationPane" id="searchPane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'Search Engines'">
                 Search Engines
            </div>

            <div class="informationPane" id="slnPane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'State/Local/National'">
                 Favorites
            </div>

            <div class="informationPane" id="mediaPane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'Media Links'">
                 Media Links
            </div>

            <div class="informationPane" id="resourcePane"
                 data-dojo-type="dijit/layout/ContentPane"
                 data-dojo-props="title: 'Online Resources'">
                 Online Resources
            </div>
         </div> 
      </div> 

      
      <div id="footer" data-dojo-type="dijit/layout/ContentPane"
           data-dojo-props="region: 'bottom'">
          <images/apache_pb.gif>  
          <images/opensuse_1.gif> 
         <br>

      </div>
   </div>
</div>
</body>
</html>
/

The problem I'm having is that the parser isn't called when the page is
loaded into IE8+. (Normally the "alert" function would not appear where it
is, it just put it in to see if I could locate the fault). When I load the
page in Firefox or Chrome, the "alert" is displayed normally; when I load
the page in IE8, the "alert" is not displayed and the tab container is not
rendered correctly.

I'm still learning Dojo and used the "Using Declarative Syntax" tutorial as
a guideline when creating the page. 

Thanks in advance!

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Parser-not-parsing-in-IE8-tp3996615.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

mattmadhavan | 17 May 2013 15:10
Picon
Favicon

AngularJS and DOJO comparison - feature by feature

Hello, 
I am looking for feature by feature comparison of DOJO and AngularJS
including pros and cons of each. Has anyone done this? Is it even fair to
compare these two? 

Thanks 
Matt 

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/AngularJS-and-DOJO-comparison-feature-by-feature-tp3996609.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Ulf Wendel | 17 May 2013 14:05
Picon

dojo.store API beginners hiccup

Dear experts,

I am all new to Dojo and tried toying around with dojo.store.

I noticed that there is a dojo.store.JsonRest but I was looking for a
dojo.store.Jsonp one. Thus, I grabbed the 1.9 source and began browsing
dojo/store/api/Store.js to learn what interface a fictional
dojo.store.Jsonp would have to provide. The inline documentation says
about Store.get:

returns: Object
  The object in the store that matches the given id

The same can be found in dojo.store.JsonRest. However, that's not the
actual return value of dojo.store.JsonRest::get().
dojo.store.JsonRest::get() returns a Deferred (from xhr). And, of
course, a fictional Jsonp store would have to do the same but judging
only from the inline documentation I got the impression this would not
be allowed...

Is that a documentation flaw?

From my beginners perspective it leaves me with two distinct user APIs:

  var storedObject = MemoryStore.get(1);
  JsonRestStore.get(1).then( function (data) { storedObject = data; } );

(Yes, when() may come handy here but still...)

This is quite in contrast to Store.query(). With my beginners hat on,
discussing only the user API, its just as I expected it to be:

  MemoryStore.query({name: "Foo"}).forEach( function (obj) { ; } );
  JsonRestStore.query({name: "Foo"}).forEach (function (obj) { ; });

Here, it makes no difference what flavour of store I use. Its
beautifully aligned, the promise is hidden... Back to the beginners
perspective: one query method (get()) does not hide the promise, the
other query method (query()) does...

Is that a common pattern/pitfall for beginners?

Thanks,
Ulf

________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Arathi Balachandran | 17 May 2013 13:40
Favicon

Dojo EditableGrid : Highlight the edited in cells in specific color

Hi All,

 

I have a dojo editable datagrid. I need to highlight the edited values in the grid in a different color once it is changed.

Could any of you suggest a way to implement this.

 

Thanks,

Arathi

**************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS***
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Umashankar, Arvind | 17 May 2013 13:09
Picon

Standalone DOJO

Hi All , 
 I want to deploy my application which i am building on DOJO 1.9  as a standalone application on iPad .. 
i.e. i dont want to host them on IIS or Apache web server .. 
But may be some how copy the files to Ipad and run them on the ipad .. 

I basic want a demo version of the app where i can take to the customers and demo it to them and ask for feedbacks .. 
Kindly let me know how i can achive this using DOJO ?


Regards,
Arvind

The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
________________________________________________________
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/
Reference Guide: http://dojotoolkit.org/reference-guide
API Documentation: http://dojotoolkit.org/api

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

Gmane