Alien-GvaScript
view release on metacpan or search on metacpan
doc/html/CustomButtons.html view on Meta::CPAN
<div class="TN_node" id="Usage">
<h3 class="TN_label">Usage</h3>
<div class="TN_content">
<div class="TN_node" id="Javascript">
<h4 class="TN_label">Javascript</h4>
<div class="TN_content">
<pre> var container = $('my_button_will_display_here');
var button_properties = {
id : 'btn_'+(new Date()).getTime(),
callback : Prototype.emptyFunction, // btnClickHandler
condition : true, // boolean indicating whether to render button
width : 'auto', // string value including unit. ex: '100px', '5em' ..
type : 'button', // button|reset|submit
style : {borderWidth: '2px'} // hash of inline style elemets to be set on the button container
label : 'GVA_SCRIPT_BUTTON' // button label
}
// create a new button and display in container
var mybutton = new GvaScript.CustomButtons.Buttons(container, button_properties);</pre>
</div>
</div>
<div class="TN_node" id="HTML">
<h4 class="TN_label">HTML</h4>
<div class="TN_content">
<p>The button will be rendered and resulting HTML will be placed in th designated container.</p>
<pre> <div id="my_button_will_display_here" style="border-width: 2px;">
<span class="gva-btn-container">
<span class="left"/>
<span class="center">
<button type="button" class="btn" style="width: auto;" id="btn_1227001526005">
GVA_SCRIPT_BUTTON
</button>
</span>
<span class="right"/>
</span>
</div></pre>
</div>
</div>
</div>
</div>
<div class="TN_node" id="Methods">
<h3 class="TN_label">Methods</h3>
<div class="TN_content">
<div class="TN_node" id="new">
<h4 class="TN_label">new</h4>
<div class="TN_content">
<pre> var mybutton = new GvaScript.CustomButtons.Buttons(container, properties);</pre>
<p>The <code>properties</code> hash describes the button behavior and display, with
the following entries :</p>
<ul>
<li><a name="item_id__i__string___i_"></a><b>id <i>(string)</i></b>
<p>unique identifier of the button - will be set to the <button> element.</p>
<p>optional - system will provide one if none provided.</p>
</li>
<li><a name="item_tabindex__i__numeric___i_"></a><b>tabindex <i>(numeric)</i></b>
<p>numeric value of the tabindex to set on the generated button element.</p>
<p>optional - button will not have tabindex attribute if none provided.</p>
</li>
<li><a name="item_callback__i__function___i_"></a><b>callback <i>(function)</i></b>
<p>onclick handler of the <button> element - will execute in the <b>button context</b>.</p>
<p>optional - defaulted to empty function.</p>
</li>
<li><a name="item_condition__i__boolean_function___i_"></a><b>condition <i>(boolean|function)</i></b>
<p>boolean value <b>or</b> a function that returns a boolean value indicating whether to render and display the button or not.
Note that if condition is false, the button will <b>not</b> be a part of the DOM.</p>
<p>optional - defaulted to true.</p>
</li>
<li><a name="item_width__i__string___i_"></a><b>width <i>(string)</i></b>
<p>string value to set on the style.width of the <button> element.
string value <b>must</b> include the unit or else will be ignored.</p>
<p>optional - defaulted to 'auto'.</p>
</li>
<li><a name="item_type__i__string___i_"></a><b>type <i>(string)</i></b>
<p>the <i>type</i> attribute of the <button> element. could be one of the following:</p>
<ul>
<li><a name="item_button"></a><b>button</b>
<p>generic behavior of the button.</p>
</li>
<li><a name="item_submit"></a><b>submit</b>
<p>submits containing <form> when clicked.</p>
</li>
<li><a name="item_reset"></a><b>reset</b>
<p>resets containing <form> when clicked.</p>
</li>
</ul>
<p>optional - default to 'button'</p>
</li>
<li><a name="item_style__i__hash___i_"></a><b>style <i>(hash)</i></b>
<p>hash containing style elements to be set to the inline style attribute of the button container element.</p>
<p>optional - defaulted to {}.</p>
</li>
<li><a name="item_label__i__string___i_"></a><b>label <i>(string)</i></b>
<p>label of the button.</p>
<p>optional - defaulted to 'GVA_SCRIPT_BUTTON'.</p>
</li>
</ul>
</div>
</div>
<div class="TN_node" id="destroy">
<h4 class="TN_label">destroy</h4>
<div class="TN_content">
<pre> mybutton.destroy()</pre>
<p>This method removes the click handler attached to the button.
Call this method when the button is removed
from the DOM.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="TN_node" id="GvaScript_CustomButtons_ButtonNavigation">
( run in 0.682 second using v1.01-cache-2.11-cpan-2398b32b56e )