1
0
mirror of synced 2025-02-04 06:09:23 +03:00

docs for #1365 placeholderOption option

This commit is contained in:
Igor Vaynberg 2013-05-31 15:22:16 -07:00
parent fa50cb0efc
commit 02faf94054
3 changed files with 23 additions and 1 deletions

View File

@ -1082,6 +1082,12 @@ $(document).ready(function () {
for the placeholder to work.
</p>
</td></tr>
<tr><td>placeholderOption</td><td>function/string</td><td>
<p>When attached to a <code>select</code> resolves the <code>option</code> that should be used as the placeholder.
Can either be a function which given the <code>select</code> element should return the <code>optoin</code>
element or a string <code>first</code> to indicate that the first option should be used.</p>
<p>This option is useful when Select2's default of using the first option only if it has no value and no text is not suitable.</p>
</td></tr>
<tr><td>separator</td><td>string</td><td>
<p>
Separator character or string used to delimit ids in <code>value</code> attribute of the multi-valued selects.

@ -1 +1 @@
Subproject commit 87e62004f67179afe5809d525f957bde8acacc78
Subproject commit 9a3666edb56339e95aaf9f2fdeb76b48030cf50a

View File

@ -48,8 +48,24 @@
-->
</div>
<input id="filter" multiple style="width: 250px;">
<button id='reset' class='btn'>Reset</button>
<script>
$(document).ready(function() {
$('#filter').select2({
multiple: true,
data:[{id:0,text:'enhancement'},{id:1,text:'bug'}]
});
$('#reset').on('click', function() {
$('#filter').select2('val','');
});
function format(state) {
if (!state.id) return state.text; // optgroup
return "<img class='flag' src='images/flags/" + state.id.toLowerCase() + ".png'/>" + state.text;