{"id":175,"date":"2010-03-20T11:30:44","date_gmt":"2010-03-20T10:30:44","guid":{"rendered":"http:\/\/www.speich.net\/articles\/?p=175"},"modified":"2010-03-20T11:30:44","modified_gmt":"2010-03-20T10:30:44","slug":"check-if-node-in-tree-is-already-selected","status":"publish","type":"post","link":"https:\/\/www.speich.net\/articles\/en\/2010\/03\/20\/check-if-node-in-tree-is-already-selected\/","title":{"rendered":"Check if node in tree is already selected"},"content":{"rendered":"<p>It took me a long time to figure out how to check if a node in a dijit.tree is already set to selected, when the user clicks on it. So I thought I share what I found out:<\/p>\n<pre class=\"prettyprint lang-js\">dojo.connect(this.tree, 'onMouseDown', this, function(evt) {\n  var node = dijit.getEnclosingWidget(evt.target);\n  if (node.item == this.tree.attr('selectedItem')) {\n    console.debug('selected');\n  }\n });<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>It took me a long time to figure out how to check if a node in a dijit.tree is already set to selected, when the user clicks on it. So I thought I share what I found out: dojo.connect(this.tree, &#8216;onMouseDown&#8217;, this, function(evt) { var node = dijit.getEnclosingWidget(evt.target); if (node.item == this.tree.attr(&#8216;selectedItem&#8217;)) { console.debug(&#8216;selected&#8217;); } });<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[26],"class_list":["post-175","post","type-post","status-publish","format-standard","hentry","category-javascript","tag-dojo","entry"],"_links":{"self":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts\/175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/comments?post=175"}],"version-history":[{"count":0,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/posts\/175\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/media?parent=175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/categories?post=175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.speich.net\/articles\/wp-json\/wp\/v2\/tags?post=175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}