X-Editable putting “Empty” after successful update

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

Answers:

Answer

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/

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.