1
0
mirror of synced 2024-11-23 05:26:10 +03:00

added 'add reference to original option element' in doc

This commit is contained in:
Emanuele Gaspari 2012-06-29 22:22:23 +02:00
parent 2054fd9870
commit feba7892ac

View File

@ -342,7 +342,7 @@ version: 2.1
<h3>Example Code</h3> <h3>Example Code</h3>
<pre class="prettyprint linenums" id="code_e4"></pre> <pre class="prettyprint linenums" id="code_e4"></pre>
<p> <p>
You can set <code>data-</code> attributes to &lt;option&gt; (or &lt;optgroup&gt;) and use them inside temptlating functions: You can set <code>data-</code> attributes to <code>&lt;option&gt;</code> (or <code>&lt;optgroup&gt;</code>) and use them inside temptlating functions:
</p> </p>
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">
&lt;select&gt; &lt;select&gt;
@ -352,7 +352,8 @@ version: 2.1
</pre> </pre>
<pre class="prettyprint linenums"> <pre class="prettyprint linenums">
function format(state) { function format(state) {
var originalOption = state.element var originalOption = state.element;
return "&lt;img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png' alt='" + originalOption.data('foo') + "' /&gt;" + state.text; return "&lt;img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png' alt='" + originalOption.data('foo') + "' /&gt;" + state.text;
} }
</pre> </pre>
@ -789,8 +790,8 @@ version: 2.1
<tr><td>&lt;returns&gt;</td><td>string</td><td>Html that represents the selection</td></tr> <tr><td>&lt;returns&gt;</td><td>string</td><td>Html that represents the selection</td></tr>
</table> </table>
The default implementation expects the object to have a <code>text</code> property that is returned. The default implementation expects the object to have a <code>text</code> property that is returned.
<br> <br><br>
Original &lt;option&gt; (or &lt;optgroup&gt;) element is accessible inside the specified function by property item.element Original <code>&lt;option&gt;</code> (or <code>&lt;optgroup&gt;</code>) element is accessible inside the specified function by property <code>item.element</code>:
<pre> <pre>
format(item) { format(item) {
var originalOption = item.element; var originalOption = item.element;
@ -807,8 +808,8 @@ version: 2.1
<tr><td>&lt;returns&gt;</td><td>string</td><td>Html that represents the result</td></tr> <tr><td>&lt;returns&gt;</td><td>string</td><td>Html that represents the result</td></tr>
</table> </table>
The default implementation expects the object to have a <code>text</code> property that is returned. The default implementation expects the object to have a <code>text</code> property that is returned.
<br> <br><br>
Original &lt;option&gt; (or &lt;optgroup&gt;) element is accessible inside the specified function by property item.element Original <code>&lt;option&gt;</code> (or <code>&lt;optgroup&gt;</code>) element is accessible inside the specified function by property <code>item.element</code>:
<pre> <pre>
format(item) { format(item) {
var originalOption = item.element; var originalOption = item.element;