﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-果酱-文章分类-DOJO</title><link>http://www.blogjava.net/chen45257211/category/51972.html</link><description /><language>zh-cn</language><lastBuildDate>Fri, 10 Aug 2012 15:10:37 GMT</lastBuildDate><pubDate>Fri, 10 Aug 2012 15:10:37 GMT</pubDate><ttl>60</ttl><item><title>关于DOJO中图片插件的注意事项</title><link>http://www.blogjava.net/chen45257211/articles/385215.html</link><dc:creator>七孑</dc:creator><author>七孑</author><pubDate>Fri, 10 Aug 2012 04:02:00 GMT</pubDate><guid>http://www.blogjava.net/chen45257211/articles/385215.html</guid><wfw:comment>http://www.blogjava.net/chen45257211/comments/385215.html</wfw:comment><comments>http://www.blogjava.net/chen45257211/articles/385215.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/chen45257211/comments/commentRss/385215.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/chen45257211/services/trackbacks/385215.html</trackback:ping><description><![CDATA[&nbsp; &nbsp; 其实在DOJO官方的例子中写的比较详细了，<div style="display: inline-block; ">dojox.image.ThumbnailPicker，</div>dojox.image.Lightbox两个插件结合用确实也很不错，不过还是有些细节问题值得注意。<br />&nbsp; &nbsp; 1.把单击弹出改成双击弹出，这样单击可以作为选中该图片，进行删除，下载等后续操作。关键代码是&nbsp;dojo.subscribe(dijit.byId('thumbPicker').getClickTopicName(), ondblclick); 函数不是直接的显示的lightbox函数，而是用一个间接的函数去绑定双击事件，触发lightbox函数。<br />&nbsp; &nbsp; 2.样式的问题，hover在IE下没用，并且官方的select也是没有效果，所以应该手动去添加。<br />&nbsp; &nbsp; 3.左右按钮，官方的例子样式写的不对（真不知道他们为什么不该），应该是background: transparent url("image/imageULbutton.png") no-repeat;<div>&nbsp; &nbsp; 关键点1,2的代码：<br /><div>&nbsp; function ondblclick(packet)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>imageId = packet.data.id;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; dojo.query(".imageGalleryThumbSelected").removeClass("imageGalleryThumbSelected");</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>dojo.addClass("img_thumbPicker_"+packet.index,"imageGalleryThumbSelected");</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>dojo.connect(dijit.byId('thumbPicker'),"onDblClick",function(){</div><div>&nbsp; &nbsp; <span style="white-space:pre">		</span>if(packet!=null){</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp;lightbox.show({</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;href: packet.largeUrl,</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;title: packet.title</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp; &nbsp;});}</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span> &nbsp; &nbsp; &nbsp;packet=null;</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>});</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; }</div></div><br /><br /><img src ="http://www.blogjava.net/chen45257211/aggbug/385215.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/chen45257211/" target="_blank">七孑</a> 2012-08-10 12:02 <a href="http://www.blogjava.net/chen45257211/articles/385215.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于lazyTreeGrid增加checkbox</title><link>http://www.blogjava.net/chen45257211/articles/383508.html</link><dc:creator>七孑</dc:creator><author>七孑</author><pubDate>Thu, 19 Jul 2012 07:22:00 GMT</pubDate><guid>http://www.blogjava.net/chen45257211/articles/383508.html</guid><wfw:comment>http://www.blogjava.net/chen45257211/comments/383508.html</wfw:comment><comments>http://www.blogjava.net/chen45257211/articles/383508.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/chen45257211/comments/commentRss/383508.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/chen45257211/services/trackbacks/383508.html</trackback:ping><description><![CDATA[&nbsp; &nbsp;没有太好的办法，只能用formatter属性来做。下面是我写的一个完整的实现方法<br />&nbsp;&nbsp;<span style="background-color: #eeeeee; font-size: 13px; color: #008080; ">&nbsp;1</span><span style="background-color: #eeeeee; font-size: 13px; ">&nbsp;</span><span style="background-color: #eeeeee; font-size: 13px; ">&nbsp;</span><span style="background-color: #eeeeee; font-size: 13px; color: #0000ff; ">function</span><span style="background-color: #eeeeee; font-size: 13px; ">(&nbsp;value,rowIndex,cells)</span><div style="background-color: #eeeeee; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: #cccccc; border-right-color: #cccccc; border-bottom-color: #cccccc; border-left-color: #cccccc; border-image: initial; padding-right: 5px; padding-bottom: 4px; padding-left: 4px; padding-top: 4px; width: 98%; word-break: break-all; "><span style="font-size: 13px; color: #008080; ">&nbsp;2</span><font size="2">&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;rowdata&nbsp;=&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">this</span><font size="2">.grid.getItem(rowIndex);</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;3</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;rowvalue&nbsp;=&nbsp;rowdata.checked.toString();</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;4</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;first&nbsp;=&nbsp;"&lt;div&nbsp;id='"+rowdata.id+"'&nbsp;style='height:15px;width:15px;float:left'";</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;5</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;last&nbsp;=&nbsp;&nbsp;"onclick='OnChangeCheck("+rowIndex+","+</font><span style="font-size: 13px; color: #0000ff; ">this</span><font size="2">.grid.id+")'&gt;&nbsp;&nbsp;&lt;/div&gt;"+value;</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;6</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(rowvalue=='</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">'){</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;7</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">return</span><font size="2">&nbsp;first+"&nbsp;class='sd-icon-checked'&nbsp;onmouseover&nbsp;='oncheckover(this)'&nbsp;onmouseout='oncheckout(this)'"+last;</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;8</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><span style="font-size: 13px; color: #0000ff; ">else</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(rowvalue=='mix'){</font><br /><span style="font-size: 13px; color: #008080; ">&nbsp;9</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">return</span><font size="2">&nbsp;first+"&nbsp;class='sd-icon-checkmix'&nbsp;onmouseover&nbsp;='oncheckmixover(this)'&nbsp;onmouseout='oncheckmixout(this)'"+last;</font><br /><span style="font-size: 13px; color: #008080; ">10</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">11</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">return</span><font size="2">&nbsp;first+"class='sd-icon-nochecked'&nbsp;onmouseover&nbsp;='onnocheckover(this)'&nbsp;onmouseout='onnocheckout(this)'"+last;</font><br /><span style="font-size: 13px; color: #008080; ">12</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">13</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">14</span><font size="2">&nbsp;};</font><br /><span style="font-size: 13px; color: #008080; ">15</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;oncheckmixout(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">16</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-checkmix";</font><br /><span style="font-size: 13px; color: #008080; ">17</span><font size="2">&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">18</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;oncheckmixover(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">19</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-overcheckmix";</font><br /><span style="font-size: 13px; color: #008080; ">20</span><font size="2">&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">21</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;onnocheckout(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">22</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-nochecked";</font><br /><span style="font-size: 13px; color: #008080; ">23</span><font size="2">&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">24</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;oncheckout(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">25</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-checked";</font><br /><span style="font-size: 13px; color: #008080; ">26</span><font size="2">&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">27</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;onnocheckover(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">28</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-overnochecked";</font><br /><span style="font-size: 13px; color: #008080; ">29</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">30</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;oncheckover(e)&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">31</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;e.className&nbsp;=&nbsp;"sd-icon-overchecked";</font><br /><span style="font-size: 13px; color: #008080; ">32</span><font size="2">&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">33</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;OnChangeCheck(rowIndexs,id)</font><br /><span style="font-size: 13px; color: #008080; ">34</span><font size="2">&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">35</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;store=dijit.byId(id).store;</font><br /><span style="font-size: 13px; color: #008080; ">36</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;rowdata&nbsp;=&nbsp;dijit.byId(id.toString()).getItem(rowIndexs);</font><br /><span style="font-size: 13px; color: #008080; ">37</span><font size="2">&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">38</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">39</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(rowdata.checked=='</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">'){</font><br /><span style="font-size: 13px; color: #008080; ">40</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(rowdata,"checked",'</font><span style="font-size: 13px; color: #0000ff; ">false</span><font size="2">');</font><br /><span style="font-size: 13px; color: #008080; ">41</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(rowdata.children!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">42</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;findChildrenItem(rowdata,'</font><span style="font-size: 13px; color: #0000ff; ">false</span><font size="2">',id);</font><br /><span style="font-size: 13px; color: #008080; ">43</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">44</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">45</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">else</span><font size="2">{</font><br /><span style="font-size: 13px; color: #008080; ">46</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(rowdata,"checked",'</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">');</font><br /><span style="font-size: 13px; color: #008080; ">47</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(rowdata.children!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">48</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;findChildrenItem(rowdata,'</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">',id);</font><br /><span style="font-size: 13px; color: #008080; ">49</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">50</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">51</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;parentItem=&nbsp;getTreeParentItem(id,rowdata);</font><br /><span style="font-size: 13px; color: #008080; ">52</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(parentItem!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">53</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;findParentItem(parentItem,id);</font><br /><span style="font-size: 13px; color: #008080; ">54</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">55</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">56</span><font size="2">&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">57</span><font size="2">&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">58</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;findChildrenItem(thisItem,value,id){</font><br /><span style="font-size: 13px; color: #008080; ">59</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;store=dijit.byId(id).store;</font><br /><span style="font-size: 13px; color: #008080; ">60</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">for</span><font size="2">(</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;k=0;k&lt;thisItem.children.length;k++){</font><br /><span style="font-size: 13px; color: #008080; ">61</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">62</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;theChildren&nbsp;=&nbsp;thisItem.children[k];</font><br /><span style="font-size: 13px; color: #008080; ">63</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(theChildren,"checked",value);</font><br /><span style="font-size: 13px; color: #008080; ">64</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(theChildren.children!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">65</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;findChildrenItem(theChildren,value,id);</font><br /><span style="font-size: 13px; color: #008080; ">66</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">67</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">68</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">69</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">70</span><font size="2">&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">71</span><font size="2">&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">function</span><font size="2">&nbsp;findParentItem(parentItem,id){</font><br /><span style="font-size: 13px; color: #008080; ">72</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;store=dijit.byId(id).store;</font><br /><span style="font-size: 13px; color: #008080; ">73</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;parentChecked&nbsp;=&nbsp;0;</font><br /><span style="font-size: 13px; color: #008080; ">74</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(parentItem!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">75</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;children&nbsp;=&nbsp;parentItem.children;</font><br /><span style="font-size: 13px; color: #008080; ">76</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">for</span><font size="2">(</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;i=0;i&lt;children.length;i++)</font><br /><span style="font-size: 13px; color: #008080; ">77</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">78</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(children[i].checked.toString()!='</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">'){</font><br /><span style="font-size: 13px; color: #008080; ">79</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(children[i].checked.toString()=='mix'){parentChecked&nbsp;+=0.5;}</font><br /><span style="font-size: 13px; color: #008080; ">80</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">else</span><font size="2">{parentChecked&nbsp;+=1;};</font><br /><span style="font-size: 13px; color: #008080; ">81</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">82</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">83</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(!parentChecked)</font><br /><span style="font-size: 13px; color: #008080; ">84</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{</font><br /><span style="font-size: 13px; color: #008080; ">85</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(parentItem,"checked",'</font><span style="font-size: 13px; color: #0000ff; ">true</span><font size="2">');</font><br /><span style="font-size: 13px; color: #008080; ">86</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><span style="font-size: 13px; color: #0000ff; ">else</span><font size="2">{</font><br /><span style="font-size: 13px; color: #008080; ">87</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(parentChecked!=parentItem.children.length||parentChecked!=parseInt(parentChecked)){&nbsp;</font><br /><span style="font-size: 13px; color: #008080; ">88</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(parentItem,"checked",'mix');</font><br /><span style="font-size: 13px; color: #008080; ">89</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">90</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">else</span><font size="2">{</font><br /><span style="font-size: 13px; color: #008080; ">91</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;store.setValue(parentItem,"checked",'</font><span style="font-size: 13px; color: #0000ff; ">false</span><font size="2">');</font><br /><span style="font-size: 13px; color: #008080; ">92</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};</font><br /><span style="font-size: 13px; color: #008080; ">93</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">94</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">95</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">var</span><font size="2">&nbsp;superParent=&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</font>PM.addCheckbox = function( value,rowIndex,cells)<div>{<span style="white-space:pre">	</span>var rowdata = this.grid.getItem(rowIndex);</div><div><span style="white-space:pre">	</span>var rowvalue = rowdata.checked.toString();</div><div><span style="white-space:pre">	</span>var first = "&lt;div id='"+rowdata.id+"' style='height:15px;width:15px;float:left'";</div><div><span style="white-space:pre">	</span>var last = &nbsp;"onclick='OnChangeCheck("+rowIndex+","+this.grid.id+")'&gt; &nbsp;&lt;/div&gt;"+value;</div><div><span style="white-space:pre">	</span>if(rowvalue=='true'){</div><div><span style="white-space:pre">		</span>return first+" class='sd-icon-checked' onmouseover ='oncheckover(this)' onmouseout='oncheckout(this)'"+last;</div><div><span style="white-space:pre">	</span>}else if(rowvalue=='mix'){</div><div><span style="white-space:pre">		</span>return first+" class='sd-icon-checkmix' onmouseover ='oncheckmixover(this)' onmouseout='oncheckmixout(this)'"+last;</div><div><span style="white-space:pre">	</span>}</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span>return first+"class='sd-icon-nochecked' onmouseover ='onnocheckover(this)' onmouseout='onnocheckout(this)'"+last;</div><div>&nbsp; &nbsp; <span style="white-space:pre">	</span></div><div>&nbsp; &nbsp;&nbsp;</div><div>};</div><div>function oncheckmixout(e) {</div><div><span style="white-space:pre">	</span>e.className = "sd-icon-checkmix";</div><div>&nbsp;}</div><div>function oncheckmixover(e) {</div><div><span style="white-space:pre">	</span>e.className = "sd-icon-overcheckmix";</div><div>&nbsp;}</div><div>function onnocheckout(e) {</div><div><span style="white-space:pre">	</span>e.className = "sd-icon-nochecked";</div><div>&nbsp;}</div><div>function oncheckout(e) {</div><div><span style="white-space:pre">	</span>e.className = "sd-icon-checked";</div><div>&nbsp;}</div><div>function onnocheckover(e) {</div><div><span style="white-space:pre">		</span>e.className = "sd-icon-overnochecked";</div><div><span style="white-space:pre">	</span> }</div><div>function oncheckover(e) {</div><div><span style="white-space:pre">	</span>e.className = "sd-icon-overchecked";</div><div>&nbsp;}</div><div>function OnChangeCheck(rowIndexs,id)</div><div>{</div><div><span style="white-space:pre">	</span>var store=dijit.byId(id).store;</div><div><span style="white-space:pre">	</span>var rowdata = dijit.byId(id.toString()).getItem(rowIndexs);</div><div></div><div><span style="white-space:pre">	</span></div><div><span style="white-space:pre">	</span>if(rowdata.checked=='true'){</div><div><span style="white-space:pre">		</span>store.setValue(rowdata,"checked",'false');</div><div><span style="white-space:pre">		</span>if(rowdata.children!=null){</div><div><span style="white-space:pre">			</span>findChildrenItem(rowdata,'false',id);</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>else{</div><div><span style="white-space:pre">		</span>store.setValue(rowdata,"checked",'true');</div><div><span style="white-space:pre">		</span>if(rowdata.children!=null){</div><div><span style="white-space:pre">			</span>findChildrenItem(rowdata,'true',id);</div><div><span style="white-space:pre">		</span>}</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>var parentItem= getTreeParentItem(id,rowdata);</div><div><span style="white-space:pre">	</span>if(parentItem!=null){</div><div><span style="white-space:pre">		</span>findParentItem(parentItem,id);</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span></div><div>}</div><div></div><div>function findChildrenItem(thisItem,value,id){</div><div><span style="white-space:pre">	</span>var store=dijit.byId(id).store;</div><div><span style="white-space:pre">	</span> for(var k=0;k&lt;thisItem.children.length;k++){</div><div><span style="white-space:pre">		</span>&nbsp;</div><div><span style="white-space:pre">		</span> var theChildren = thisItem.children[k];</div><div><span style="white-space:pre">		</span> store.setValue(theChildren,"checked",value);</div><div><span style="white-space:pre">		</span> if(theChildren.children!=null){</div><div><span style="white-space:pre">			</span> findChildrenItem(theChildren,value,id);</div><div><span style="white-space:pre">		</span> }</div><div><span style="white-space:pre">		</span> <span style="white-space:pre">	</span>&nbsp;</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span></div><div>}</div><div>function findParentItem(parentItem,id){</div><div><span style="white-space:pre">	</span>var store=dijit.byId(id).store;</div><div><span style="white-space:pre">	</span>var parentChecked = 0;</div><div><span style="white-space:pre">	</span>if(parentItem!=null){</div><div><span style="white-space:pre">		</span> var children = parentItem.children;</div><div><span style="white-space:pre">		</span> for(var i=0;i&lt;children.length;i++)</div><div><span style="white-space:pre">		</span> {<span style="white-space:pre">	</span></div><div><span style="white-space:pre">		</span> <span style="white-space:pre">	</span>if(children[i].checked.toString()!='true'){</div><div><span style="white-space:pre">		</span> <span style="white-space:pre">		</span>if(children[i].checked.toString()=='mix'){parentChecked +=0.5;}</div><div><span style="white-space:pre">		</span> <span style="white-space:pre">		</span>else{parentChecked +=1;};</div><div><span style="white-space:pre">		</span> <span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; }</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; if(!parentChecked)</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; {</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; <span style="white-space:pre">	</span>store.setValue(parentItem,"checked",'true');</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; }else{</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">	</span> if(parentChecked!=parentItem.children.length||parentChecked!=parseInt(parentChecked)){&nbsp;</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">		</span> store.setValue(parentItem,"checked",'mix');</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">		</span> }</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">	</span> else{</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">		</span> store.setValue(parentItem,"checked",'false');</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp;<span style="white-space:pre">		</span> };</div><div><span style="white-space:pre">	</span> &nbsp; &nbsp; }</div><div><span style="white-space:pre">	</span>}</div><div><span style="white-space:pre">	</span>var superParent= getTreeParentItem(id,parentItem);</div><div><span style="white-space:pre">	</span>if(superParent!=null){</div><div><span style="white-space:pre">		</span>findParentItem(superParent,id);</div><div><span style="white-space:pre">	</span>}</div><br />}<font size="2">(id,parentItem);</font><br /><span style="font-size: 13px; color: #008080; ">96</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><span style="font-size: 13px; color: #0000ff; ">if</span><font size="2">(superParent!=</font><span style="font-size: 13px; color: #0000ff; ">null</span><font size="2">){</font><br /><span style="font-size: 13px; color: #008080; ">97</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;findParentItem(superParent,id);</font><br /><span style="font-size: 13px; color: #008080; ">98</span><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</font><br /><span style="font-size: 13px; color: #008080; ">99</span><font size="2">&nbsp;}</font></div>&nbsp; &nbsp; 写的可能比较繁琐，没有优化，是用图片控制的，因为formatter函数中不能使用dojo 的组件，这有点遗憾。图片在dojo包的\dojox\form\resources\images中，自己找一下。<span style="background-color: #eeeeee; ">getTreeParentItem是公司封装的方法，查找父节点，这里就不贴了，网上找一找就行，希望对有这类任务的人有帮助</span><img src ="http://www.blogjava.net/chen45257211/aggbug/383508.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/chen45257211/" target="_blank">七孑</a> 2012-07-19 15:22 <a href="http://www.blogjava.net/chen45257211/articles/383508.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>关于DOJO中dialog遮罩的问题</title><link>http://www.blogjava.net/chen45257211/articles/380786.html</link><dc:creator>七孑</dc:creator><author>七孑</author><pubDate>Thu, 14 Jun 2012 07:16:00 GMT</pubDate><guid>http://www.blogjava.net/chen45257211/articles/380786.html</guid><wfw:comment>http://www.blogjava.net/chen45257211/comments/380786.html</wfw:comment><comments>http://www.blogjava.net/chen45257211/articles/380786.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/chen45257211/comments/commentRss/380786.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/chen45257211/services/trackbacks/380786.html</trackback:ping><description><![CDATA[很久没写东西了，以前发表的文章也大多都是转载的，前段时间看到一篇文章，说开发人员为什么不喜欢写技术博客，感觉挺有感触的，大多数原因是解决了就该忙其他的事情了，不去管这些东西了，还有就是怕不够深入，写的不对，让人笑话。<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 最近几天接到任务要解决一个DOJO中dialog的BUG，感觉弄了好几天很烦躁，也许是我技术比较烂，高手应该很容易解决，但是我希望能记录下来，能给同样碰到问题的人一些帮助，这样码的那么多字就不算白费。<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; dialog是自带遮罩功能的，但是我们在使用的时候，有可能不需要遮罩这个东西，怎么把它去掉呢？如果使用的是dojox的dialog，modal属性直接可以去掉遮罩，但是DOJO1.7以后推荐使用DialogSimple，因为它继承了ContentPane。但是却没有了modal属性，怎么办？&nbsp; &nbsp;有几种办法：<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 1.&nbsp;dojo.byId("id").childNodes[0].style.display="none"; id是在页面上遮罩的id，可以都过firebug看到<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 2.dojo.destroy('id'); id是你生成dialog的id<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 3.dijit._underlay.hide();<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 4.dijit._underlay.domNode.style.display = "none";<br style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 13px; line-height: 19px; background-color: #28557e; " />&nbsp; &nbsp; 第一种肯定不是最好的办法，因为id这个东西不是固定的，并且很有可能是系统自动生成的。第二种会出现新的问题，因为当你页面中存在很多个dialog时，他们都是共用一个遮罩的，这样其他的dialog如果还想使用遮罩就是不可能的了。第三种是我在网上看到的办法，但是很遗憾，会报错，原因找到了，是因为hide的时候有这一句this.bgIframe.destroy()，但是你关闭dialog时调用的hide方法又会销毁一次bgIframe，会显示找不到bgIframe。所以我进入了DialogUnderlay中的hide方法，发现主要的代码就是第四种方法！如果想要显示就使用dijit._underlay.domNode.style.display = "block"，是不是完美解决了？&nbsp;<img src ="http://www.blogjava.net/chen45257211/aggbug/380786.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/chen45257211/" target="_blank">七孑</a> 2012-06-14 15:16 <a href="http://www.blogjava.net/chen45257211/articles/380786.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>