api
コールをソースとして使用すると、xeditable
とselect2
が動作し、すべてがうまく動作します。提出後にxeditableとselect2ドロップダウンが表示されました
select2ドロップダウンを送信した後、テーブルの値はEMPTY
と表示され、正しい値に更新するにはページの更新が必要です。
値を選択したselect2
の値に更新する方法を知っている人はいますか?
私のhtml:再び
$('#example .eo_role a').editable({
params: function(params) { //params already contain `name`, `value` and `pk`
var data = {};
data[params.name] = params.value;
return data;
},
source: 'http://localhost:8000/api/eo_role/select_two_data/',
tpl: '<select></select>',
ajaxOptions: {
type: 'put'
},
select2: {
cacheDatasource:true,
width: '150px',
id: function(pk) {
return pk.id;
},
ajax: {
url: 'http://localhost:8000/api/eo_role/select_two_data/',
dataType: "json",
type: 'GET',
processResults: function(item) {return item;}
}
},
formatSelection: function (item) {
return item.text;
},
formatResult: function (item) {
return item.text;
},
templateResult: function (item) {
return item.text;
},
templateSelection : function (item) {
return item.text;
},
});
- すべての作品(データベースの更新、ドロップダウンリストを移入など)が<td>
は"EMPTY"
で更新されるドロップダウンを提出した後:
<td class="eo_role"><a href="#" data-pk={{r.pk}} data-type="select2" data-url="/api/entry/{{r.pk}}/"
data-name="eo_role" data-title="Enter EO_role">{{r.eo_role}}</a></td>
は私のJSです - 正しい値を表示するためにページを更新する必要があります。
私はリンクされた同様の問題を解決しようとしましたが、機能しませんでした。 https://stackoverflow.com/questions/28190106/x-editable-putting-empty-after-successful-update – TangoAlee