X-Editable putting “Empty” after successful update

无人久伴 提交于 2019-12-11 04:32:48

问题


I am using X-Editable plugin for inline editing on a table but I am getting a annoying problem. After the successful request and the successful updates, the plugin puts "Empty" instead the correct updated value on the table cell.

My site is restful, so I am doing PUT requests to URLs like http://example.com/admin/year/<id> to make database updates.

I've made a JSFiddle to show my problem, but on JSFiddle, the X-Editable keeps the infinite "loading" after ajax request. Take a look: http://jsfiddle.net/wqqr3cL3/4/

Thanks


回答1:


OK! Got it! To solve this problem I used the attribute display of X-Editable. So, from X-Editable display attribute documentation:

Callback to perform custom displaying of value in element's text. If null, default input's display used. If false, no displaying methods will be called, element's text will never change. Runs under element's scope.

I updated my code and after the response from AJAX request, I update the text this way:

//ommited x-editable other code...        
display: function (value, sourceData, response) {
   $(this).html(response.value);
}

Here an working example but using text box. I used a select box. The link: http://jsfiddle.net/xBB5x/278/



来源:https://stackoverflow.com/questions/28190106/x-editable-putting-empty-after-successful-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!