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

Updating source of select2 ajax input #423

Open justinmccombs opened 10 years ago

justinmccombs commented 10 years ago

Consider this: http://jsfiddle.net/wQysh/47/

When changing the state from Florida to Georgia, and updating the source url, the select2 still shows the Florida Counties instead of the Georgia Counties

vitalets commented 10 years ago

good case. I don't found in select2 docs is it supports update of url. Anyway the possible solution is to re-init second select2: http://jsfiddle.net/wQysh/51/

Koka5 commented 10 years ago

it seems not working... there is bug
Uncaught TypeError: Cannot call method 'data' of undefined

stack : MOCK GET: /states jquery.mockjax.js:483 Uncaught TypeError: Cannot call method 'data' of undefined bootstrap-editable.min.js:5 e.extend.destroy bootstrap-editable.min.js:5 t.destroy bootstrap-editable.min.js:5 (anonymous function) bootstrap-editable.min.js:5 jQuery.extend.each jquery-git.js:402 jQuery.fn.jQuery.each jquery-git.js:143 e.fn.editable bootstrap-editable.min.js:5 initCountries (index):69 $.editable.success (index):61 (anonymous function) bootstrap-editable.min.js:5 proxy jquery-git.js:574 fire jquery-git.js:3116 self.add jquery-git.js:3162 t.submit bootstrap-editable.min.js:5 proxy jquery-git.js:574 jQuery.event.dispatch jquery-git.js:4640 elemData.handle jquery-git.js:4308

ycswaves commented 10 years ago

@Koka5 did you do something like this: $(this.find('/your element').editable('destroy').editable({ .... });

If so, try to remove "editable('destroy')"