AnanthaKN / jquery-in-place-editor

Automatically exported from code.google.com/p/jquery-in-place-editor
Other
0 stars 0 forks source link

Notes on Using <select> #123

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If you want select_text (the message in the options list when the field has no 
entry--defaults to "Choose new value") to not be used, set the select_text 
parameter to "" and change the beginning of createSelectEditor to read:
        var default_text_option = this.settings.select_text === "" ? "" : '<option disabled="true" value="">' + this.settings.select_text + '</option>';

        var editor = $('<select' + this.inputNameAndClass() + '>' + default_text_option + '</select>');

If your select options are value/name pairs and you want the name corresponding 
to the initial value to be selected when the editor starts, you need to use the 
willOpenEditInPlace delegated function to translate the value to the name. Add 
the following to the parameter hash:
  delegate: { willOpenEditInPlace: function() { return "#{initial_value}" } }
where in the example #{initial_value} is Ruby code that evaluates to the name 
initially selected.

Similarly, the when editing is complete, the callback or server will be sent 
the value and must return the name to be displayed.

Original issue reported on code.google.com by g.w.s...@comcast.net on 6 Dec 2012 at 2:02