Jquery 使用append()添加表行,并使用REDITABLE对其进行编辑

Jquery 使用append()添加表行,并使用REDITABLE对其进行编辑,jquery,json,jeditable,Jquery,Json,Jeditable,所以我有一个表,它的内容是用json加载的 $(document).ready(function () { $(".click").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", { indicator : "<img src='img/indicator.gif'>", tooltip : "Click to edit...", s

所以我有一个表,它的内容是用json加载的

$(document).ready(function () {
    $(".click").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
        indicator : "<img src='img/indicator.gif'>",
        tooltip   : "Click to edit...",
        style  : "inherit"
    });

    $.getJSON('../ajax/ajax_get_data.php', function(data) {
        $.each(data.split, function(i) {
            $('.wk_skile_table > tbody:last').append('<tr><td class="click">'+i+'</b></td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.split+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');

            //or add dynamically 
            $("td").each(function() {
                $(this).addClass("click");
            });
        });

        $.each(data.aux, function(i) {
            $('.wk_aux_table > tbody:last').append('<tr><td>'+i+'</td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');
        });
    });
});
$(文档).ready(函数(){
$(“.click”)。可编辑(“http://www.appelsiini.net/projects/jeditable/php/echo.php", {
指标:“,
工具提示:“单击以编辑…”,
风格:“继承”
});
$.getJSON('../ajax/ajax\u get\u data.php',函数(数据){
$.each(data.split,function(i){
$('.wk_skile_table>tbody:last')。追加('+i+'+this.row1+'+this.row2+'+this.split+'+this.oranger_start+'+this.red_start+'+this.blinking+);
//或者动态添加
$(“td”)。每个(函数(){
$(此).addClass(“单击”);
});
});
$.each(data.aux,函数(i){
$('.wk_aux_table>tbody:last')。追加(''+i+''+this.row1+''+this.row2+''+this.oranger_start+''+this.red_start+''+this.blinking+'');
});
});
});
但当我使用append()时,它将不起作用:\

你有什么办法修理它吗

更新 下面是一个例子

问题是表“未看到”。请单击“类”。我把密码改成

$("th").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
    indicator : "<img src='img/indicator.gif'>",
    tooltip   : "Click to edit...",
    style  : "inherit"
});
$(“th”)。可编辑(“http://www.appelsiini.net/projects/jeditable/php/echo.php", {
指标:“,
工具提示:“单击以编辑…”,
风格:“继承”
});
并且可以很好地用于html(它写在html文件中)。但对于通过append()函数添加到表中的td

$(“td”)。可编辑(“http://www.appelsiini.net/projects/jeditable/php/echo.php", {
指标:“,
工具提示:“单击以编辑…”,
风格:“继承”
});
不起作用。。。
更新:


我在追加之后移动了jeditable init,现在它可以工作了:)

我终于找到了答案

$(document).ready(function () {

    $.ajax({
        url: '../ajax/ajax_get_data.php',
        async: false,
        dataType: 'json',
        success: function(data) {
        $.each(data.split, function(i) {
            // 'this' is the value of the object item
            // key is the map/object key, value is value
            $('.wk_skile_table > tbody:last').append('<tr><td>'+i+'</b></td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.split+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');

        });

        $.each(data.aux, function(i) {
            // 'this' is the value of the object item
            // key is the map/object key, value is value
            $('.wk_aux_table > tbody:last').append('<tr><td>'+i+'</td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');
        });
        }
    });

    $("td").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
        indicator : "<img src='img/indicator.gif'>",
        tooltip   : "Click to edit...",
        style  : "inherit"
    }); 
});
$(文档).ready(函数(){
$.ajax({
url:“../ajax/ajax_get_data.php”,
async:false,
数据类型:“json”,
成功:功能(数据){
$.each(data.split,function(i){
//“this”是对象项的值
//键是贴图/对象键,值是值
$('.wk_skile_table>tbody:last')。追加('+i+'+this.row1+'+this.row2+'+this.split+'+this.oranger_start+'+this.red_start+'+this.blinking+);
});
$.each(data.aux,函数(i){
//“this”是对象项的值
//键是贴图/对象键,值是值
$('.wk_aux_table>tbody:last')。追加(''+i+''+this.row1+''+this.row2+''+this.oranger_start+''+this.red_start+''+this.blinking+'');
});
}
});
$(“td”)。可编辑(“http://www.appelsiini.net/projects/jeditable/php/echo.php", {
指标:“,
工具提示:“单击以编辑…”,
风格:“继承”
}); 
});

可能是getJSON的问题,因为脚本是异步的。使用此脚本,一切正常。

请稍微修改一下fiddle@FC不:(我已经手动添加了它,每个函数都有。它仍然不起作用。)(我想问题出在别处,我已经用同样的方法使用了jeditable,它起作用了。
$(document).ready(function () {

    $.ajax({
        url: '../ajax/ajax_get_data.php',
        async: false,
        dataType: 'json',
        success: function(data) {
        $.each(data.split, function(i) {
            // 'this' is the value of the object item
            // key is the map/object key, value is value
            $('.wk_skile_table > tbody:last').append('<tr><td>'+i+'</b></td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.split+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');

        });

        $.each(data.aux, function(i) {
            // 'this' is the value of the object item
            // key is the map/object key, value is value
            $('.wk_aux_table > tbody:last').append('<tr><td>'+i+'</td><td>'+this.row1+'</td><td>'+this.row2+'</td><td>'+this.orange_start+'</td><td>'+this.red_start+'</td><td>'+this.blinking+'</td>');
        });
        }
    });

    $("td").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
        indicator : "<img src='img/indicator.gif'>",
        tooltip   : "Click to edit...",
        style  : "inherit"
    }); 
});