vitalets / x-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
http://vitalets.github.io/x-editable
MIT License
6.51k stars 1.72k forks source link

typeaheadjs with remote show the "value" field instead of the "text" field #1050

Open giacomomasseron opened 7 years ago

giacomomasseron commented 7 years ago

Hi, I do not know why the typeaheadjs editable shows the value field instead of the text field.

This is my code:

<a href="javascript:void(0)" class="x-birth_place_id editable-empty editable editable-click" data-name="x-birth_place_id" data-type="typeaheadjs" data-pk="1" data-url="url-to-post" data-value="" data-title="Edit" title="" data-emptytext="Add" data-original-title="Edit">Add</a>

jQuery('.x-birth_place_id').editable({
    typeahead: {
        minLength: 3,
        highlight: true,
        limit: 10,
        remote: '...?q=%QUERY',
    }
});

This is the result of the remote URL: [{"value":1,"text":"First text"},{"value":2,"text":"Second text"},{"value":3,"text":"Third text"}]

But instead of seeing the "First text" value, I see 1 (the value field).

How can I solve it?