egroupware/phpgwapi/js/dhtmlxtree/docsExplorer/dhtmlxmenu/dhtmlxmenu___event_oncheckboxclick.html

160 lines
11 KiB
HTML
Raw Normal View History

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
lang="en" dir="ltr">
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="../codebase/default.css" type="text/css" media="screen" title="no title" charset="utf-8"><title>
dhtmlxmenu:event_oncheckboxclick [DHX documentation]
</title></head>
<body>
<div class="dokuwiki">
<div class="stylehead">
<div class="header">
<a class="logo" href="http://dhtmlx.com" title="DHTMLX Home Page"></a>
<span class="tittle-dhtmlx">DHTMLX Docs & Samples Explorer</span>
<div class="search-field">
<form action="/dhtmlx/docs/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><button type="submit"></button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form> </div>
<div class="buttons">
<a class="doc"></a>
<a title="DHTMLX Samples homepage" href="../samples.html" class="sample"/></a>
</div>
<!-- <div class="pagename">
[[<a href="#" title="Backlinks">dhtmlxmenu:event_oncheckboxclick</a>]]
</div>
<div class="logo">
<a href="/dhtmlx/docs/doku.php" name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[H]">DHX documentation</a> </div>
<div class="clearer"></div>-->
</div>
<!-- <div class="bar" id="bar__top">
<div class="bar-left" id="bar__topleft">
<form class="button btn_edit" method="post" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Edit this page" class="button" accesskey="e" title="Edit this page [E]" /></div></form> <form class="button btn_revs" method="get" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form> </div>
<div class="bar-right" id="bar__topright">
<form class="button btn_recent" method="get" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="recent" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Recent changes" class="button" accesskey="r" title="Recent changes [R]" /></div></form> <form action="/dhtmlx/docs/doku.php" accept-charset="utf-8" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" title="Search" /><button type="submit"></button><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form>&nbsp;
</div>
<div class="clearer"></div>
</div> -->
<!-- <div class="breadcrumbs">
<span class="bchead">Trace:</span> <span class="bcsep">&raquo;</span> <span class="curid"><a href="/dhtmlx/docs/doku.php?id=dhtmlxmenu:event_oncheckboxclick" class="breadcrumbs" title="dhtmlxmenu:event_oncheckboxclick">event_oncheckboxclick</a></span> </div>
-->
</div>
<div class="page">
<!-- wikipage start -->
<p>
<div class='backlinks'><div class='backlink last_backlink'><img src="icons___file.gif" class="media" alt="" /><a href="../index.html" class="wikilink1" title="start">Index</a></div><div class='arrow'></div><div class='backlink last_backlink'><img src="icons___menu.gif" class="media" alt="" /><a href=index.html class="wikilink1" title="dhtmlxmenu:toc">dhtmlxmenu</a></div><div class='arrow'></div><div class='backlink'><a href="dhtmlxmenu___event_handling.html" class="wikilink1" title="dhtmlxmenu:event_handling">Event Handling</a></div></div>
</p>
<h2><a name="oncheckboxclick_event" id="oncheckboxclick_event">onCheckboxClick Event</a></h2>
<div class="level2">
<p>
By default this event changes the state of the clicked checkbox item. The visible sub-polygon won&#039;t be hidden after this action.
onCheckboxClick event can call user-defined handler (if there is any) and pass the following parameters:
</p>
<ul>
<li class="level1"><div class="li"> id - id of the clicked checkbox item;</div>
</li>
<li class="level1"><div class="li"> state - state of the clicked checkbox item. Defines whether the item is checked or not;</div>
</li>
<li class="level1"><div class="li"> zoneId (only for Contextual Menu) - id of the contextual menu zone;</div>
</li>
<li class="level1"><div class="li"> casState - whether the key “Ctrl”, “Alt”, or “Shift” was pressed with click or not.</div>
</li>
</ul>
<pre class="code javascript"> menu.<span class="me1">attachEvent</span><span class="br0">&#40;</span><span class="st0">&quot;onCheckboxClick&quot;</span><span class="sy0">,</span> <span class="kw2">function</span><span class="br0">&#40;</span>id<span class="sy0">,</span> state<span class="sy0">,</span> zoneId<span class="sy0">,</span> casState<span class="br0">&#41;</span><span class="br0">&#123;</span>
...
<span class="co1">// user-defined handler</span>
<span class="co1">// ctrl</span>
<span class="kw1">if</span> <span class="br0">&#40;</span>casState<span class="br0">&#91;</span><span class="st0">&quot;ctrl&quot;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="kw2">true</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="co1">// ctrl key was pressed with click</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
<span class="co1">// ctrl key was not pressed with click</span>
<span class="br0">&#125;</span>
<span class="co1">// alt</span>
<span class="kw1">if</span> <span class="br0">&#40;</span>casState<span class="br0">&#91;</span><span class="st0">&quot;alt&quot;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="kw2">true</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="co1">// alt key was pressed with click</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
<span class="co1">// alt key was not pressed with click</span>
<span class="br0">&#125;</span>
<span class="co1">// shift</span>
<span class="kw1">if</span> <span class="br0">&#40;</span>casState<span class="br0">&#91;</span><span class="st0">&quot;shift&quot;</span><span class="br0">&#93;</span> <span class="sy0">==</span> <span class="kw2">true</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
<span class="co1">// shift key was pressed with click</span>
<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span>
<span class="co1">// shift key was not pressed with click</span>
<span class="br0">&#125;</span>
<span class="kw1">return</span> <span class="kw2">true</span>;
<span class="br0">&#125;</span><span class="br0">&#41;</span>;</pre>
<p>
When the user attaches a user-defined handler to this event, the state of the item can no longer be changed automatically. The user can control this by returning true|false from a user-defined handler. That&#039;s why, return true should be added after a user-defined handler in order to let the script know that the state of the item should be changed.
</p>
</div>
<div class="secedit"><form class="button btn_secedit" method="post" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="lines" value="83-" /><input type="hidden" name="rev" value="1279031290" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Edit" class="button" title="onCheckboxClick Event" /></div></form></div>
<!-- wikipage stop -->
</div>
<div class="clearer">&nbsp;</div>
<div class="stylefoot">
<div class="meta">
<div class="user">
</div>
<!-- <div class="doc">
dhtmlxmenu/event_oncheckboxclick.txt &middot; Last modified: 2010/07/13 17:28 (external edit) </div>
</div>-->
<!--<div class="bar" id="bar__bottom">-->
<!--<div class="bar-left" id="bar__bottomleft">-->
<!--<form class="button btn_edit" method="post" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Edit this page" class="button" accesskey="e" title="Edit this page [E]" /></div></form>-->
<!--<form class="button btn_revs" method="get" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="revisions" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Old revisions" class="button" accesskey="o" title="Old revisions [O]" /></div></form>-->
<!--</div>-->
<!--<div class="bar-right" id="bar__bottomright">-->
<!---->
<!---->
<!---->
<!---->
<!---->
<!--<form class="button btn_index" method="get" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="index" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Index" class="button" accesskey="x" title="Index [X]" /></div></form>-->
<!--<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="Back to top" onclick="window.scrollTo(0, 0)" title="Back to top" /></a>&nbsp;-->
<!--</div>-->
<!--<div class="clearer"></div>-->
<!--</div>-->
</div>
</div>
<div class="footerinc">
</div>
<div class="no"><img src="/dhtmlx/docs/lib/exe/indexer.php?id=dhtmlxmenu%3Aevent_oncheckboxclick&amp;1279804901" width="1" height="1" alt="" /></div>
<div class="footer">
<div class="footer-logo"></div>
<div class="copyright">Copyright © 1998-2009 DHTMLX LTD.<br />All rights reserved.</div>
<form class="button btn_edit" method="post" action="/dhtmlx/docs/doku.php"><div class="no"><input type="hidden" name="do" value="edit" /><input type="hidden" name="rev" value="" /><input type="hidden" name="id" value="dhtmlxmenu:event_oncheckboxclick" /><input type="submit" value="Edit this page" class="button" accesskey="e" title="Edit this page [E]" /></div></form> </div>
</body>
</html>