1
0
mirror of synced 2024-11-26 23:06:02 +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>
<pre class="prettyprint linenums" id="code_e4"></pre>
<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>
<pre class="prettyprint linenums">
&lt;select&gt;
@ -352,7 +352,8 @@ version: 2.1
</pre>
<pre class="prettyprint linenums">
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;
}
</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>
</table>
The default implementation expects the object to have a <code>text</code> property that is returned.
<br>
Original &lt;option&gt; (or &lt;optgroup&gt;) element is accessible inside the specified function by property item.element
<br><br>
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>
format(item) {
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>
</table>
The default implementation expects the object to have a <code>text</code> property that is returned.
<br>
Original &lt;option&gt; (or &lt;optgroup&gt;) element is accessible inside the specified function by property item.element
<br><br>
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>
format(item) {
var originalOption = item.element;