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

Cannot read property '_off' of undefined #827

Open viandanteoscuro opened 8 years ago

viandanteoscuro commented 8 years ago

Hi, i have this problem with the jquery ui version, when i click on the editable.

Cannot read property '_off' of undefined

At this line:

jqueryui-editable.js:4717

this.container()._off(this.container().element, 'mouseover focusin');

My structure is a ul with many link with class "product", with data-pk, data-name and data-value. I initialize the plugin simply:

$(document).on("ready", function() { $(".product").editable(); });

jQuery 2.1.3, jQuery ui 1.11.4

The same issue if i use jquery 1.X (>= 1.9) and ui 1.X (>= 1.9)

With the bootstrap version no error, but i can't use bootstrap because i use materializecss, and i have visual problems...

saske505 commented 8 years ago

Hi @viandanteoscuro I had the same problem tried a couple of things to try and solve the problem and finally what worked was to follow the example jquery x-editable template from http://jsfiddle.net/xBB5x/197, I saved each library that they use to my project.

and used the example code

$('#username').editable({
    type: 'text',
    url: '/post',    
    pk: 1,    
    placement: 'top',
    title: 'Enter username'    
});

//ajax emulation. Type "err" to see error message
$.mockjax({
    url: '/post',
    responseTime: 400,
    response: function(settings) {
        if(settings.data.value == 'err') {
           this.status = 500;  
           this.responseText = 'Validation error!';
        } else {
           this.responseText = '';  
        }
    }
}); 
<p>Plain jQuery + poshytip</p>
<div style="margin: 150px">
    <a href="#" id="username">awesome</a>
</div>

still a bit buggy at times but its a start