mc007 | 6 Mar 06:44 2015

how to use dgrid/List ?

Hi,
i updated to master from 0.4 and again nothings works anymore. This time, it
wants everywhere totalLength as Deferred, regardless its a Memory Store.
Since I am using OnDemandGrid, this could make some sense....actually not to
me at all since memory is memory, nothing to fetch through a Dfd. 

However, I tried to get dgrid/List instead but nothing gets rendered. I
tried with different data and stores, but no. 

Is it possible that dgrid is not a real general purpose widget? I am just
wondering because its pretty hard to get things working. Last time it took
me weeks to update all, and this time I am getting busted for another 2 days
again. 

well, no offence but its getting really annoying to use it.

-----
PHP based file manager powered by Dojo toolkit 
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/how-to-use-dgrid-List-tp4005537.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

mc007 | 5 Mar 22:01 2015

Re: group some buttons

hi,
i dont know much about the dijit editor, but you may want to have a look
into:
- dijit editor plugins
- dijit drop down button

down loadthe source code from github (dojo/dijit) to see how its done.

if you need this functionality more frequent, let me know. I am working
since a while on some code which generalizes 'user actions' and chooses  the
right render (dropdown) basing on some input array:
https://github.com/mc007/xide-js/blob/master/bean/Action.js
you will need also the mixins from xide/widgets/*

-----
PHP based file manager powered by Dojo toolkit 
--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/group-some-buttons-tp4005534p4005536.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

lbowman | 5 Mar 16:53 2015
Picon

Writing to the DOM with JQuery inside a Dojo class function

I had already created some JQuery code to dynamically build a list of
accordion panels.  I am wondering what the draw back is of including them in
my dojo function.

$function() {

$("#catalogPanels").append('<div>my html code to insert</div>');
$("#catalogPanels").append('<div>more html code to insert</div>');

}

JQuery just seemed so much more straight forward than the dom.create or
dom.place elements of dojo and the code was already developed.  I am curious
what the drawbacks of this approach are though.

Thanks,

Lisa

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Writing-to-the-DOM-with-JQuery-inside-a-Dojo-class-function-tp4005532.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

(Continue reading)

Stephen Gevers | 4 Mar 20:55 2015

Fwd: pwCheck function in PasswordValidator



Begin forwarded message:

From: Stephen Gevers <nabble <at> steve.gevers5.com>
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator
Date: March 4, 2015 at 1:51:11 PM CST

I’m not sure what you mean by “main require” and “main javascript file”.  Is the main require in a script tag in HTML?  Is the function validateUserEntered embedded inside a require of it’s own?  That would explain your undefined function as validateUserEntered’s scope would be the require inside your main javascript file and not accessible to anything outside.  But even if you solve that, you still have issues in the code below.  In the “then” function you supply for validateUserEntered, where do you expect the “return true” to go?  Also, since your button is a widget, I don’t think you want dom.byId.  I believe you want on(registry.byId().domNode, …).  Or registry.byId().on(…).

The problem I think you are having is that you are trying to use AMD without creating any modules.  If I’m correct in the layout (and what you mean by main require and main javascript), you need to think of it this way: You have two different require invocations with two different callbacks.  The stuff that’s declared inside one of those call backs is not accessible to the other one without some trickery.  And that trickery is also considered bad practice.

So you need to restructure a bit.  Your main javascript file needs to have a “define” rather than a “require”.  By using “define” you can expose things in your main javascript file to things inside other “require” functions.  I’m going to assume you are loading your main javascript file using a script tag in the same way you are loading dojo itself and that you are loading it from the URL /js/main.js  The first thing we want to do is to have dojo load your file itself, rather than you doing it through the script tag.  To do so, we have to consider it to be part of a “package”.  Before you load dojo, you should create a script tag that contains the following (not in a require):
var dojoConfig = {
packages: [ { name: ‘myApp’, location: ‘/js’ } ];
];

In your main require, add a dependency for "myApp/main”.  This will cause your main javascript file to be loaded and processed.  You will also need to add a corresponding argument to the require call back function.

In your main.js, change the “require” to “define”.  The parameters are the same: an array of dependencies and a callback function with an argument list that matches the array.  The only difference is that you will be returning something.  That something will be mapped to the parameter you added to your main require.  So it will look something like this:

define ([…], function (…) {
return {
validateUserEntered: function () {
//function body
},

// other functions you want to use outside this function
};
});

In your main require you would have

require ([…, ‘myApp/main’], function (…, main) {
parser.parse();
on(registry.byId(‘accountInfo’).domNode, ‘click’, function (evt) {
main.validateUserEntered().then(function (data) {
console.log(“valid user”);
});
});
});

On Mar 4, 2015, at 1:02 PM, Harry Devine <lifter89 <at> comcast.net> wrote:

Sorry, still now working.  I'm defining my button as follows:

<button data-dojo-type="dijit/form/Button" type="button" id="accountInfo">Show Account Info</button>

In my main require, I have:

parser.parse();
on(dom.byId("accountInfo"), 'click', function(evt) {
  validateUserEntered().then(function(data) {
    return true;
  });
});

And in my main javascript file, I have validateUserEntered as follows:

function validateUserEntered() {
  var dfd = new Deferred();
  if (!registry.byId("username").get("value")) {
    dom.byId("ldapResult".innerHTML = "User name not specified!";
    dfd.reject("fail");
  }
  else {
    dfd.resolve("success");
  }
}

The error I get is:  Uncaught ReferenceError: validateUserEntered is not defined.

Obviously I'm missing something basic.  I'm trying to make my main javascript file have requires for all dojo modules I'll need in there, and then have the functions defined within the require/function blocks.  Like I mentioned earlier, I always had these types of errors doing it this way but having require/function in each sub function always worked, but according to Karl, this way is wrong.  So how do I fix this?

Thanks,
Harry


--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Koren, Bradley | 4 Mar 19:15 2015

Accessing dojo button outside script

Hello,

 

I have a script that contains a dojo button widget. The button is created in the script as follows. 

 

Then outside the dojo script, in another script I need to enable this button. Can the button be accessed in the other script? 

 

 

SCRIPT:        var btnSave = new Button({

               id: "_OK",

               name: "OK",

               label: "Submit",

               disabled: 'disabled',

               onClick: function () {

                   save();

               },

               required: false,

               autoComplete: true,

           }, "_OK").startup();

 

 

HTML:     <button id='_OK'>Submit</button>&nbsp;

 

Thanks for any help!



This County of Chester e-mail message, including any attachments, is intended for the sole use of the individual(s) and entity(ies) to whom it is addressed, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone this e-mail message including any attachments, or any information contained in this e-mail message including any attachments. If you have received this e-mail message in error, please immediately notify the sender by reply e-mail and delete the message. Thank you very much.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Fabian Brandt | 4 Mar 13:20 2015
Picon

dojox gfx moveable event migration from connect to on/aspect

Hello,

actually I´m having problems migrating from dojo.connect to
dojo.on/dojo.aspect with the Moveable module from dojox.gfx. In the past, if
I wanted to register an event to a moveable group (as defined in gfx), I
could do dojo.connect(moveableOfGroup, "onMoved", function(mover,shift) ...

Since that is deprecated the Moveable can not be connected to dojo.on, the
only remaining thing is to use dojo.aspect. This generally works, but
however shift is always undefined. I tried every combination of
after/around/before and onMoved, onMoving and so on. The question is - what
would be the best way to do this?

Thanks in advance
Fabian

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojox-gfx-moveable-event-migration-from-connect-to-on-aspect-tp4005516.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

Dojo-interest <at> mail.dojotoolkit.org
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
lbowman | 3 Mar 20:50 2015
Picon

dojo-smore/QueryStore sort

In the processSort function, the default value for descending is set to '-'. 
I altered this and now it is being set to:

//ORIGINAL:  value += (sort[i].descending ? '-' : '') + sort[i].attribute +
',';
//MINE:
value += (sort[i].descending ? '' + sort[i].attribute + '\&order\=desc'  :
'');

However, during processRequest, my ampersand and equal sign are being
converted to encoded characters:

%26 for the ampersand and %3D for the equal sign.

What about the process request is actually causing this encoding?

Thanks,

Lisa

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/dojo-smore-QueryStore-sort-tp4005513.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

lbowman | 3 Mar 07:19 2015
Picon

Populating Dgrid column with object data

My dgrid structure is this:

var store = new QueryRead({
                url:
'https://www.sciencebase.gov/catalog/items?format=json&filter=ancestors=4f4e4773e4b07f02db47e241&fields=title,summary,dates,contacts',
                startParam: 'offset',
                countParam: 'max',
});

my store is from 'dojo_smore/QueryRead',

this.tableGrid = new(declare([OnDemandGrid, ColumnHider]))({
      store: store,
      columns: {
            'id': 'id',
            'title': 'Title',
            'date': 'Publication Date
      }         
}, id);

Each item in the store has the following structure:

{
        "id": <unique id>,
         "title":"....",
         "summary":"...",
         "contacts":[...],
         "dates":[
                      {"type":"Publication",
                        "dateString":"2014-12-11",
                        "label":"Publication Date"
                      },
                      {"type":""dateCreated"",
                        "dateString":"2014-06-09T09:49:47.148-06:00",
                        "label":"Date Created"
                      },

                    ]
}

The 'date' column for my dgrid only wants to store publication dates.

How can I populate the 'date' column in my grid with 'dateString' from a
date object that matches "type" === "publication" 

I would have included a jsfiddle, but I can't figure out how to include the
external resource for 'QueryStore' from dojo-smore since it doesn't seem to
have a cdn.

Thanks,

Lisa

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Populating-Dgrid-column-with-object-data-tp4005498.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

Darryl Wilson | 2 Mar 22:12 2015
Picon

Re: Dojo-interest Digest, Vol 123, Issue 4

UNSUBSCRIBE

Darryl Wilson

p +64 4 499 3546
m +64 27 566 1551
www.e-spatial.co.nz

-----Original Message-----
From: dojo-interest-bounces <at> mail.dojotoolkit.org
[mailto:dojo-interest-bounces <at> mail.dojotoolkit.org] On Behalf Of dojo-interest-request <at> mail.dojotoolkit.org
Sent: Tuesday, 3 March 2015 10:10 a.m.
To: dojo-interest <at> mail.dojotoolkit.org
Subject: Dojo-interest Digest, Vol 123, Issue 4

Send Dojo-interest mailing list submissions to
	dojo-interest <at> mail.dojotoolkit.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
or, via email, send a message with subject or body 'help' to
	dojo-interest-request <at> mail.dojotoolkit.org

You can reach the person managing the list at
	dojo-interest-owner <at> mail.dojotoolkit.org

When replying, please edit your Subject line so it is more specific than "Re: Contents of Dojo-interest digest..."

Today's Topics:

   1. Re: pwCheck function in PasswordValidator (Harry Devine)
   2. Re: pwCheck function in PasswordValidator (Harry Devine)
   3. Re: Dijit styles when running two Dojo versions (zcurtis)
   4. Re: pwCheck function in PasswordValidator (Fred Duarte)

----------------------------------------------------------------------

Message: 1
Date: Mon, 2 Mar 2015 20:48:15 +0000 (UTC)
From: Harry Devine <lifter89 <at> comcast.net>
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator
To: dojo-interest <at> mail.dojotoolkit.org
Message-ID:
	<1188421556.2435882.1425329295333.JavaMail.zimbra <at> comcast.net>
Content-Type: text/plain; charset="utf-8"

Well, I'm defining my button on my page as follows (the main js file has already been included at this point): 

<button data-dojo-type="dijit/form/Button" type="button"> Show Account Info <script
type="dojo/on" data-dojo-event="click" data-dojo-args="evt"> validateUserEntered(); </script>
</button> 

So I believe I'm already using dojo/on, so why wouldn't the function be found in my js file? 

Thanks,
Harry
----- Original Message -----

From: "Stephen Gevers" <nabble <at> steve.gevers5.com>
To: dojo-interest <at> mail.dojotoolkit.org
Sent: Monday, March 2, 2015 2:25:58 PM
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator 

validateUserEntered is defined in the scope in which it was declared?that means it?s only defined inside
the callback function for require. Without knowing how you are trying to use the function, it?s difficult
to say how to fix it. The idea behind AMD is to limit the pollution of the global name space. As Karl pointed
out, it may not be the best idea to make the validateUserEntered function global. However, it is easy to
do?simply set window.validateUserEntered equal to your function inside the require callback.
However, there are still timing issues. window.validateUserEnetered will not be defined until the
require callback is executed. And the callback won?t be executed until all of its dependencies have been
loaded. So it?s possible that the loader could still be trying to load ?dijit/
 registry? when you are wanting to use window.validateUserEntered. It?s unlikely if you are waiting on
user input before attempting to use the function that the loader wouldn?t have completed
  this task. But it?s important to understand that some unknown amount of JavaScript code can be executed
before the callback for this require is invoked. 

My best guess is that you have some JavaScript attached to a DOM element; for example, an onclick attribute
on a button. In this case, you are probably calling some function that has to be defined in the global
namespace and that?s why you have gotten hung up on the nesting order of require / function def. A better way
might be to add some code to your require that uses dojo/on to attach a function to that button. Since the
function you would be attaching to handle the click event would be declared in the same scope as
validateUserEntered, you wouldn?t need it to be global. 

Steve 

On Mar 2, 2015, at 12:54 PM, Harry Devine < lifter89 <at> comcast.net > wrote: 

OK so I'm trying to understand what I've read and the examples given. I have restructured my main js file to be
similar to below: 

require([
"dijit/registry",
"dojo/dom",
"dojo/Deferred",
], function (registry, dom, Deferred){ 

function validateUserEntered() {
// check user entered here
}
// other functions here! 
}); 

The problem I'm running into is I get an error stating that validateUserEntered is not defined. This was the
reason why I had the requires in each subfunction because doing it this was, as was suggested, wouldn't
work and would give me these type of errors. So how do I go about making this work? I'm moving towards using
Deferred on my async functions as was suggested, but in order to get to that function in my execution chain,
I have to get this working first. 

Thanks! 
Harry 

----- Original Message -----

From: "Karl Tiedt" < ktiedt <at> gmail.com >
To: dojo-interest <at> mail.dojotoolkit.org
Sent: Friday, February 27, 2015 7:50:55 PM
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator 

Inline, because the wording on this response leads to so many possible misconceptions... And lets be
honest, ambiguity is no help to comprehension. Harry, you would benefit greatly from looking over this
link regarding Deferreds, http://dojotoolkit.org/documentation/tutorials/1.6/deferreds/ 

-Karl Tiedt 

On Fri, Feb 27, 2015 at 12:16 PM, Stephen Gevers < nabble <at> steve.gevers5.com > wrote: 

<blockquote>

Harry?You?re going to have to really think through what?s happening at each line. Notice that where you are
returning the deferred is inside the require call back function. The checkPassword function has no
return value. 

Harry, this is the key problem with doing inline requires the way you were writing yours. 

<blockquote>

Any return from the require call back function is ignored. 

</blockquote>

This is a very broad statement, if returns from require callbacks were ignored, AMD would never work... In
this particular case, yes the return is ignored because we never exploit it. 

<blockquote>

That?s the basis of what your problem is below. But you seem to be missing the async/deferred/promise
concept all together. And require fits right into that async concept. When you call checkPassword, the
callback function to required will not necessarily be called before the call to checkPassword returns. 

</blockquote>

That is also an overly generalized statement, the require() callback *HAS* to complete before the
checkPassword call "returns" assuming that "returns" means resolves... If by "returns" you mean "go to
the next line of code to execute" then you are correct, the entirety of the checkPassword function will
complete after that. 

<blockquote>

Assuming you need your function to be globally defined, you would rework your code to something like this: 

</blockquote>

Lets not assume this, because we would much rather teach GOOD practices. 

<blockquote>

require ([?dojo/request?, ?dojo/Deferred?], function (request, Deferred) { window.checkPassword =
function (password) { // checkPassword body here?now you can return a Deferred, which will be the result
of calling the function, like you have below }; }); 

Note that you can?t assume that the checkPassword function is available yet! If the next line of code after
this require was to call checkPassword, it would probably fail. 

</blockquote>

Aside from not promoting bad habits I have to say, HUH? You just defined checkPassword, it is absolutely
safe to assume it is define... Maybe Harry isn't the only one who could use some practice in async behavior
;) 

<blockquote>

For this reason, it would be better to define checkPassword as its own AMD module. 

</blockquote>

Yup, you should definitely spend some time reviewing how this works as well... Breaking a single function
out into it's own module does nothing to help improve your knowledge of "when its available", and unless
this single function is worthy of its own module, you are just creating additional overhead. 
Here is a fully commented example of how I might right the code with some assumption that this is the executed
JS file, not part of a modular piece of code (pastebin here: http://pastebin.com/1KiVHSuv ) 

require([
"dijit/registry",
"dojo/request",
"dojo/Deferred" 
], function(registry, request, Deferred) { 

// NOTE: This is written as if it is not a module, but your main JS file that gets executed on page load... 
// checkPassword would NOT be a global method so you would be calling it from some sibling code inside this
file... 

function checkPassword(password) {
var dfd = new Deferred(); // Create a deferred object that we will resolve at a later time
console.log("c1: inside checkPassword()"); request.post("checkPwd.php", { // Make XHR Post request
to checkPwd.php
handleAs: "json",
data: {
'user': registry.byId("username").get("value"), // accessing .value isnt the best practice either,
should almost always use the getter/setter
'pwd': password
}
}).then(function(data) { // Our XHR request completed... lets check the status and see if its a success or a failure
console.log("c2: checkPassword() response", data); if (data.status == "true") {// Success! 
console.log ("true");
dfd.resolve(data); // Resolve our deferred object with the data from the XHR response incase we want to
expose the results from the promise } else { // Failure! 
console.log ("false");
dfd.reject(data); // Reject our deferred object again with the data from the XHR response so that you could
tailor an error message or something from it } }); 

return dfd.promise; // Return the deferred's promise which is then'able. 
} 

// For demo purposes I have added a console message in each stage of the Async process and I have numbered them
in the order they are written in code just to help illustrate the round about way Async happens c# are
generated by code in checkPassword and m# are from the code surrounding the checkPassword call 

console.log("m1: before checkPassword()"); // NOTE: To use this method you would then do something like
this... and since we used resolve and reject you could do this
checkPassword(yourPass).then(logThemIn, kickThemOut); // What this means is if checkPassword
success, pass its data to LogThemIn() else pass the failure data to kickThemOut()
console.log("m2: after checkPassword()"); }); 

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/ 

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

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/ 

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

</blockquote>

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/ 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20150302/a952c666/attachment-0001.htm 

------------------------------

Message: 2
Date: Mon, 2 Mar 2015 20:50:34 +0000 (UTC)
From: Harry Devine <lifter89 <at> comcast.net>
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator
To: dojo-interest <at> mail.dojotoolkit.org
Message-ID:
	<764552550.2437609.1425329434162.JavaMail.zimbra <at> comcast.net>
Content-Type: text/plain; charset="utf-8"

I just tried your suggestion and it didn't work. Same error. 

Thanks,
Harry 

----- Original Message -----

From: "John Norris" <jnorris <at> connectedsignals.com>
To: dojo-interest <at> mail.dojotoolkit.org
Sent: Monday, March 2, 2015 1:58:54 PM
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator 

You can do this: 

var validateUserEntered = null; 

require([
"dijit/registry",
"dojo/dom",
"dojo/Deferred",
], function(registry, dom, Deferred){ 

validateUserEntered = function() {
// check user entered here
} 

// other functions here! 
}); 

That puts validateUserEntered in global scope, and therefore accessible from anywhere. Of course, if you
try to call it before it's set, you'll have other problems. 

On 3/2/15 10:54 AM, Harry Devine wrote: 
> OK so I'm trying to understand what I've read and the examples given. 
> I have restructured my main js file to be similar to below: 
> 
> require([
> "dijit/registry",
> "dojo/dom",
> "dojo/Deferred",
> ], function (registry, dom, Deferred){
> 
> function validateUserEntered() {
> // check user entered here
> }
> // other functions here! 
> });
> 
> The problem I'm running into is I get an error stating that 
> validateUserEntered is not defined. This was the reason why I had the 
> requires in each subfunction because doing it this was, as was 
> suggested, wouldn't work and would give me these type of errors. So 
> how do I go about making this work? I'm moving towards using Deferred 
> on my async functions as was suggested, but in order to get to that 
> function in my execution chain, I have to get this working first.
> 
> Thanks! 
> Harry
> 
> ----------------------------------------------------------------------
> --
> *From: *"Karl Tiedt" <ktiedt <at> gmail.com>
> *To: *dojo-interest <at> mail.dojotoolkit.org
> *Sent: *Friday, February 27, 2015 7:50:55 PM
> *Subject: *Re: [Dojo-interest] pwCheck function in PasswordValidator
> 
> Inline, because the wording on this response leads to so many possible 
> misconceptions... And lets be honest, ambiguity is no help to 
> comprehension. Harry, you would benefit greatly from looking over this 
> link regarding Deferreds, 
> http://dojotoolkit.org/documentation/tutorials/1.6/deferreds/
> 
> -Karl Tiedt
> 
> On Fri, Feb 27, 2015 at 12:16 PM, Stephen Gevers 
> <nabble <at> steve.gevers5.com <mailto:nabble <at> steve.gevers5.com>> wrote:
> 
> Harry?You?re going to have to really think through what?s happening at 
> each line. Notice that where you are returning the deferred is inside 
> the require call back function. The checkPassword function has no 
> return value.
> 
> 
> Harry, this is the key problem with doing inline requires the way you 
> were writing yours.
> 
> Any return from the require call back function is ignored. 
> 
> 
> This is a very broad statement, if returns from require callbacks were 
> ignored, AMD would never work... In this particular case, yes the 
> return is ignored because we never exploit it.
> 
> That?s the basis of what your problem is below. But you seem to be 
> missing the async/deferred/promise concept all together. And require 
> fits right into that async concept. When you call checkPassword, the 
> callback function to required will not necessarily be called before 
> the call to checkPassword returns.
> 
> 
> That is also an overly generalized statement, the require() callback
> *HAS* to complete before the checkPassword call "returns" assuming 
> that "returns" means resolves... If by "returns" you mean "go to the 
> next line of code to execute" then you are correct, the entirety of 
> the checkPassword function will complete after that.
> 
> Assuming you need your function to be globally defined, you would 
> rework your code to something like this:
> 
> 
> Lets not assume this, because we would much rather teach GOOD practices. 
> 
> require ([?dojo/request?, ?dojo/Deferred?], function (request,
> Deferred) {
> window.checkPassword = function (password) { // checkPassword body 
> here?now you can return a Deferred, which will be the result of 
> calling the function, like you have below }; });
> 
> Note that you can?t assume that the checkPassword function is 
> available yet! If the next line of code after this require was to call 
> checkPassword, it would probably fail.
> 
> 
> Aside from not promoting bad habits I have to say, HUH? You just 
> defined checkPassword, it is absolutely safe to assume it is define...
> Maybe Harry isn't the only one who could use some practice in async 
> behavior ;)
> 
> For this reason, it would be better to define checkPassword as its own 
> AMD module.
> 
> 
> Yup, you should definitely spend some time reviewing how this works as 
> well... Breaking a single function out into it's own module does 
> nothing to help improve your knowledge of "when its available", and 
> unless this single function is worthy of its own module, you are just 
> creating additional overhead.
> Here is a fully commented example of how I might right the code with 
> some assumption that this is the executed JS file, not part of a 
> modular piece of code (pastebin here: http://pastebin.com/1KiVHSuv )
> 
> require([
> "dijit/registry",
> "dojo/request",
> "dojo/Deferred" 
> ], function(registry, request, Deferred) {
> 
> // NOTE: This is written as if it is not a module, but your main JS 
> file that gets executed on page load...
> // checkPassword would NOT be a global method so you would be calling 
> it from some sibling code inside this file...
> 
> function checkPassword(password) {
> var dfd = new Deferred();// Create a deferred object that we will 
> resolve at a later time
> console.log("c1: inside checkPassword()"); 
> request.post("checkPwd.php", {// Make XHR Post request to checkPwd.php
> handleAs: "json",
> data: {
> 'user': registry.byId("username").get("value"), // accessing .value 
> isnt the best practice either, should almost always use the 
> getter/setter
> 'pwd': password
> }
> }).then(function(data) {// Our XHR request completed... lets check the 
> status and see if its a success or a failure
> console.log("c2: checkPassword() response", data); if (data.status == 
> "true") {// Success!
> console.log ("true");
> dfd.resolve(data);// Resolve our deferred object with the data from 
> the XHR response incase we want to expose the results from the promise 
> } else {// Failure!
> console.log ("false");
> dfd.reject(data);// Reject our deferred object again with the data 
> from the XHR response so that you could tailor an error message or 
> something from it } });
> 
> return dfd.promise;// Return the deferred's promise which is then'able. 
> }
> 
> // For demo purposes I have added a console message in each stage of 
> the Async process and I have numbered them in the order they are 
> written in code just to help illustrate the round about way Async 
> happens c# are generated by code in checkPassword and m# are from the 
> code surrounding the checkPassword call
> 
> console.log("m1: before checkPassword()"); // NOTE: To use this method 
> you would then do something like this...
> and since we used resolve and reject you could do this 
> checkPassword(yourPass).then(logThemIn, kickThemOut);// What this 
> means is if checkPassword success, pass its data to LogThemIn() else 
> pass the failure data to kickThemOut()
> console.log("m2: after checkPassword()"); });
> 
> 
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
> 
> Dojo-interest <at> mail.dojotoolkit.org
> To unsubscribe, visit: 
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
> 
> 
> 

--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/ 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20150302/b5d8a100/attachment-0001.htm 

------------------------------

Message: 3
Date: Mon, 2 Mar 2015 13:54:15 -0700 (MST)
From: zcurtis <ZCurtis <at> tsys.com>
Subject: Re: [Dojo-interest] Dijit styles when running two Dojo
	versions
To: dojo-interest <at> mail.dojotoolkit.org
Message-ID: <1425329655137-4005492.post <at> n3.nabble.com>
Content-Type: text/plain; charset=us-ascii

We have used nihilo for 1.5. For 1.10 we were leaning to claro. We have included both styles in the head.

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dijit-styles-when-running-two-Dojo-versions-tp4005451p4005492.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.

------------------------------

Message: 4
Date: Mon, 2 Mar 2015 16:09:57 -0500
From: Fred Duarte <fduartej <at> gmail.com>
Subject: Re: [Dojo-interest] pwCheck function in PasswordValidator
To: dojo-interest <at> mail.dojotoolkit.org
Message-ID:
	<CAE3t4AGzaXLsY7AKP35xV9gtatUffq8eELxeTn920_v7hbhRsw <at> mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

unsuscribe

2015-03-02 14:25 GMT-05:00 Stephen Gevers <nabble <at> steve.gevers5.com>:

> validateUserEntered is defined in the scope in which it was 
> declared?that means it?s only defined inside the callback function for 
> require.  Without knowing how you are trying to use the function, it?s 
> difficult to say how to fix it.  The idea behind AMD is to limit the 
> pollution of the global name space.  As Karl pointed out, it may not 
> be the best idea to make the validateUserEntered function global.  
> However, it is easy to do?simply set window.validateUserEntered equal 
> to your function inside the require callback.  However, there are still timing issues.
>  window.validateUserEnetered will not be defined until the require 
> callback is executed.  And the callback won?t be executed until all of 
> its dependencies have been loaded.  So it?s possible that the loader 
> could still be trying to load ?dijit/registry? when you are wanting to 
> use window.validateUserEntered.  It?s unlikely if you are waiting on 
> user input before attempting to use the function that the loader 
> wouldn?t have completed this task.  But it?s important to understand 
> that some unknown amount of JavaScript code can be executed before the 
> callback for this require is invoked.
>
> My best guess is that you have some JavaScript attached to a DOM 
> element; for example, an onclick attribute on a button.  In this case, 
> you are probably calling some function that has to be defined in the 
> global namespace and that?s why you have gotten hung up on the nesting 
> order of require / function def.  A better way might be to add some 
> code to your require that uses dojo/on to attach a function to that 
> button.  Since the function you would be attaching to handle the click 
> event would be declared in the same scope as validateUserEntered, you 
> wouldn?t need it to be global.
>
> Steve
>
> On Mar 2, 2015, at 12:54 PM, Harry Devine <lifter89 <at> comcast.net> wrote:
>
> OK so I'm trying to understand what I've read and the examples given.  
> I have restructured my main js file to be similar to below:
>
> require([
>   "dijit/registry",
>   "dojo/dom",
>   "dojo/Deferred",
> ], function (registry, dom, Deferred){
>
>   function validateUserEntered() {
>     // check user entered here
>   }
>
>   // other functions here!
> });
>
> The problem I'm running into is I get an error stating that 
> validateUserEntered is not defined.  This was the reason why I had the 
> requires in each subfunction because doing it this was, as was 
> suggested, wouldn't work and would give me these type of errors.  So 
> how do I go about making this work?  I'm moving towards using Deferred 
> on my async functions as was suggested, but in order to get to that 
> function in my execution chain, I have to get this working first.
>
> Thanks!
> Harry
>
> ------------------------------
> *From: *"Karl Tiedt" <ktiedt <at> gmail.com>
> *To: *dojo-interest <at> mail.dojotoolkit.org
> *Sent: *Friday, February 27, 2015 7:50:55 PM
> *Subject: *Re: [Dojo-interest] pwCheck function in PasswordValidator
>
> Inline, because the wording on this response leads to so many possible 
> misconceptions... And lets be honest, ambiguity is no help to 
> comprehension. Harry, you would benefit greatly from looking over this 
> link regarding Deferreds, 
> http://dojotoolkit.org/documentation/tutorials/1.6/deferreds/
>
> -Karl Tiedt
>
> On Fri, Feb 27, 2015 at 12:16 PM, Stephen Gevers 
> <nabble <at> steve.gevers5.com
> > wrote:
>
>> Harry?You?re going to have to really think through what?s happening 
>> at each line.  Notice that where you are returning the deferred is 
>> inside the require call back function.  The checkPassword function has no return value.
>>
>
> Harry, this is the key problem with doing inline requires the way you 
> were writing yours.
>
>
>>  Any return from the require call back function is ignored.
>>
>
> This is a very broad statement, if returns from require callbacks were 
> ignored, AMD would never work... In this particular case, yes the 
> return is ignored because we never exploit it.
>
>
>>  That?s the basis of what your problem is below.  But you seem to be 
>> missing the async/deferred/promise concept all together.  And require 
>> fits right into that async concept.  When you call checkPassword, the 
>> callback function to required will not necessarily be called before 
>> the call to checkPassword returns.
>>
>
> That is also an overly generalized statement, the require() callback 
> *HAS* to complete before the checkPassword call "returns" assuming that "returns"
> means resolves... If by "returns" you mean "go to the next line of 
> code to execute" then you are correct, the entirety of the 
> checkPassword function will complete after that.
>
>
>>  Assuming you need your function to be globally defined, you would 
>> rework your code to something like this:
>>
>
> Lets not assume this, because we would much rather teach GOOD practices.
>
>
>> require ([?dojo/request?, ?dojo/Deferred?], function (request, 
>> Deferred) { window.checkPassword = function (password) { // 
>> checkPassword body here?now you can return a Deferred, which will be 
>> the result of calling the function, like you have below }; });
>>
>> Note that you can?t assume that the checkPassword function is 
>> available yet!  If the next line of code after this require was to 
>> call checkPassword, it would probably fail.
>>
>
> Aside from not promoting bad habits I have to say, HUH? You just 
> defined checkPassword, it is absolutely safe to assume it is define... 
> Maybe Harry isn't the only one who could use some practice in async 
> behavior ;)
>
>
>>  For this reason, it would be better to define checkPassword as its 
>> own AMD module.
>>
>
> Yup, you should definitely spend some time reviewing how this works as 
> well... Breaking a single function out into it's own module does 
> nothing to help improve your knowledge of "when its available", and 
> unless this single function is worthy of its own module, you are just 
> creating additional overhead.
>
> Here is a fully commented example of how I might right the code with 
> some assumption that this is the executed JS file, not part of a 
> modular piece of code (pastebin here: http://pastebin.com/1KiVHSuv )
>
> require([
> "dijit/registry",
> "dojo/request",
> "dojo/Deferred"
> ], function(registry, request, Deferred) {
>
> // NOTE: This is written as if it is not a module, but your main JS 
> file that gets executed on page load...
> //   checkPassword would NOT be a global method so you would be calling
> it from some sibling code inside this file...
>
> function checkPassword(password) {
> var dfd = new Deferred(); // Create a deferred object that we will 
> resolve at a later time
> console.log("c1: inside checkPassword()"); 
> request.post("checkPwd.php", { // Make XHR Post request to 
> checkPwd.php
> handleAs: "json",
> data: {
> 'user': registry.byId("username").get("value"), // accessing .value 
> isnt the best practice either, should almost always use the 
> getter/setter
> 'pwd': password
> }
> }).then(function(data) { // Our XHR request completed... lets check 
> the status and see if its a success or a failure
> console.log("c2: checkPassword() response", data); if (data.status == 
> "true") {// Success!
> console.log ("true");
> dfd.resolve(data); // Resolve our deferred object with the data from 
> the XHR response incase we want to expose the results from the promise 
> } else { // Failure!
> console.log ("false");
> dfd.reject(data); // Reject our deferred object again with the data 
> from the XHR response so that you could tailor an error message or 
> something from it } });
>
> return dfd.promise; // Return the deferred's promise which is then'able.
> }
>
> // For demo purposes I have added a console message in each stage of 
> the Async process and I have numbered them in the order they are 
> written in code just to help illustrate the round about way Async 
> happens c# are generated by code in checkPassword and m# are from the 
> code surrounding the checkPassword call
>
> console.log("m1: before checkPassword()"); // NOTE: To use this method 
> you would then do something like this... and since we used resolve and 
> reject you could do this checkPassword(yourPass).then(logThemIn, 
> kickThemOut); // What this means is if checkPassword success, pass its 
> data to LogThemIn() else pass the failure data to kickThemOut()
> console.log("m2: after checkPassword()"); });
>
>
>
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
>
> Dojo-interest <at> mail.dojotoolkit.org
> To unsubscribe, visit:
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
>
> Dojo-interest <at> mail.dojotoolkit.org
> To unsubscribe, visit:
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>
>
> --
> Dojo Toolkit: http://dojotoolkit.org/
> Tutorials: http://dojotoolkit.org/documentation/
>
> Dojo-interest <at> mail.dojotoolkit.org
> To unsubscribe, visit:
> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>
>

--
Regards,
Fred Duarte
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20150302/a4d79503/attachment.htm 

------------------------------

________________
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

End of Dojo-interest Digest, Vol 123, Issue 4
*********************************************
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

7dr3am7 | 2 Mar 15:59 2015
Picon

Dojo 1.9 backward compatibility

Howdy!

I have several widgets that use dojo 1.6.4 and I was looking into building
them with an upgraded version of dojo.

So here are my questions:

A) Can I build widgets (developed using dojo 1.6.4) with dojo 1.9? 

B) Is dojo 1.9 backward compatible to 1.6? I am only aware of 1.7 being
backward compatible but maybe 1.9 is backward compatible to the pre-AMD
loading too.

Thank you for your time

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Dojo-1-9-backward-compatibility-tp4005485.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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

alfonsoarc | 2 Mar 15:50 2015
Picon

Drag in Tree widget initiated without actually dragging

Hello,

I am working on a application that uses a Tree widget with drag and drop
capabilities and with support for context menu (using it in conjunction with
the Menu widget).

I upgraded dojo recently to 1.10.4 and found that if I right click on one of
the Tree items, so that the pop-up menu appears and then move my cursor
(without pressing any mouse buttons) to the left or right, the widget thinks
that I started a drag operation.

I have checked and I could not reproduce this issue on dojo 1.10.2, which is
the version I was using before.

I created a standalone application, based on the 'Drag and Drop' and
'Context Menu' samples on the  Dojo documentation
<http://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html>   to make sure
I was not doing anything wrong in my app and got the issue as well:

---

require([
  "dojo/aspect",
  "dojo/_base/window",
  "dojo/store/Memory",
  "dojo/store/Observable",
  "dijit/Tree",
  "dijit/tree/ObjectStoreModel",
  "dijit/tree/dndSource",
  "dijit/Menu",
  "dijit/MenuItem",
  "dojo/domReady!"
], function(aspect, win, Memory, Observable, Tree, ObjectStoreModel,
dndSource, Menu, MenuItem) {

  // Create test store, adding the getChildren() method required by
ObjectStoreModel,
  // and making put(child, {parent: parent}) work
  var memoryStore = new Memory({
    data: [
      { id: 'world', name: 'The earth', type: 'planet', population: '6
billion'},
      { id: 'AF', name: 'Africa', type: 'continent', population: '900
million', area: '30,221,532 sq km',
        timezone: '-1 UTC to +4 UTC', parent: 'world'},
      { id: 'EG', name: 'Egypt', type: 'country', parent: 'AF' },
      { id: 'KE', name: 'Kenya', type: 'country', parent: 'AF' },
      { id: 'Nairobi', name: 'Nairobi', type: 'city', parent: 'KE' },
      { id: 'Mombasa', name: 'Mombasa', type: 'city', parent: 'KE' },
      { id: 'SD', name: 'Sudan', type: 'country', parent: 'AF' },
      { id: 'Khartoum', name: 'Khartoum', type: 'city', parent: 'SD' },
      { id: 'AS', name: 'Asia', type: 'continent', parent: 'world' },
      { id: 'CN', name: 'China', type: 'country', parent: 'AS' },
      { id: 'IN', name: 'India', type: 'country', parent: 'AS' },
      { id: 'RU', name: 'Russia', type: 'country', parent: 'AS' },
      { id: 'MN', name: 'Mongolia', type: 'country', parent: 'AS' },
      { id: 'OC', name: 'Oceania', type: 'continent', population: '21
million', parent: 'world'},
      { id: 'AU', name: 'Australia', type: 'country', population: '21
million', parent: 'OC'},
      { id: 'EU', name: 'Europe', type: 'continent', parent: 'world' },
      { id: 'DE', name: 'Germany', type: 'country', parent: 'EU' },
      { id: 'FR', name: 'France', type: 'country', parent: 'EU' },
      { id: 'ES', name: 'Spain', type: 'country', parent: 'EU' },
      { id: 'IT', name: 'Italy', type: 'country', parent: 'EU' },
      { id: 'NA', name: 'North America', type: 'continent', parent: 'world'
},
      { id: 'MX', name: 'Mexico', type: 'country', population: '108
million', area: '1,972,550 sq km',
        parent: 'NA' },
      { id: 'Mexico City', name: 'Mexico City', type: 'city', population:
'19 million', timezone: '-6 UTC', parent: 'MX'},
      { id: 'Guadalajara', name: 'Guadalajara', type: 'city', population: '4
million', timezone: '-6 UTC', parent: 'MX' },
      { id: 'CA', name: 'Canada', type: 'country', population: '33 million',
area: '9,984,670 sq km', parent: 'NA' },
      { id: 'Ottawa', name: 'Ottawa', type: 'city', population: '0.9
million', timezone: '-5 UTC', parent: 'CA'},
      { id: 'Toronto', name: 'Toronto', type: 'city', population: '2.5
million', timezone: '-5 UTC', parent: 'CA' },
      { id: 'US', name: 'United States of America', type: 'country', parent:
'NA' },
      { id: 'SA', name: 'South America', type: 'continent', parent: 'world'
},
      { id: 'BR', name: 'Brazil', type: 'country', population: '186
million', parent: 'SA' },
      { id: 'AR', name: 'Argentina', type: 'country', population: '40
million', parent: 'SA' }
    ],
    getChildren: function(object) {
      return this.query({parent: object.id});
    }
  });
  aspect.around(memoryStore, "put", function(originalPut) {
    // To support DnD, the store must support put(child, {parent: parent}).
    // Since memory store doesn't, we hack it.
    // Since our store is relational, that just amounts to setting
child.parent
    // to the parent's id.
    return function(obj, options) {
      if (options && options.parent) {
        obj.parent = options.parent.id;
      }
      return originalPut.call(memoryStore, obj, options);
    }
  });

  // Wrap the store in Observable so that updates to the store are reflected
to the Tree
  var observableStore = new Observable(memoryStore);

  // Create the model
  var myModel = new ObjectStoreModel({
    store: observableStore,
    query: {id: 'world'}
  });

  // Create Tree
  var tree = new Tree({
    model: myModel,
    dndController: dndSource
  });

  tree.placeAt(win.body()).startup();

  // Create context menu for trees
  var contextMenu = new Menu({
    targetNodeIds: [tree.id],
    selector: ".dijitTreeNode"
  });

  contextMenu.addChild(new MenuItem({
    label: "Click here",
    onClick: function(evt){
      var node = this.getParent().currentTarget;
      console.log("menu clicked for node ", node);
    }
  }));

});

---

Is there anything I could do to solve this?

Sorry for just pasting my code here, but I was getting the error described 
in this page <https://github.com/jsfiddle/jsfiddle-issues/issues/282>   when
trying to use jsfiddle.

Thank you very much,
Alfonso

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Drag-in-Tree-widget-initiated-without-actually-dragging-tp4005484.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--

-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

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


Gmane