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

Ajax #789

Open nekulin opened 9 years ago

nekulin commented 9 years ago

I regret widget Yong works with Ajax you have to do

yiiGridView.settings[users-grid'].afterAjaxUpdate = function(){
$('#users-grid a[rel="EditableField_all"]').editable();
});

Is it possible to solve this problem globally and beautiful ?

nekulin commented 9 years ago

File Editable.php

    //wrap in anonymous function for live update
    if($this->liveTarget) {
        $script .= "\n $('body').on('ajaxUpdate.editable', function(e){
        if(e.target.id == '".$this->liveTarget."') yiiEditable();
           // ajax
            var grid_id = $('div.grid-view').attr('id');
            $(grid_id).yiiGridView.settings[grid_id].afterAjaxUpdate = function(id, data){ yiiEditable(); };
        });";
        $script = "(function yiiEditable() {\n ".$script."\n}());";
    }