javascript - X-editable processing json -
i trying implement remote select using x-editable. i've followed this example , got local select work.
according example, select input expects data in format "value|text".
my backend json respose
[{"id":1,"title":"..."},{"id":2,"title":"..."}]
this html
<a href="#" id="remote-select" data-type="select" data-pk="1" data-url="/articles" data-title="select remote status"></a>
i've learned, according this answer datafilter should used, don't know how manipulate response change keys, id value , title text.
i'd independent of key's text, works different types of responses, not ones 'title' key
jquery
$('#remote-select').editable({ value: 2, source:'/articles.json', datafilter: function(resp){ } });
Comments
Post a Comment