如何使用<input />字段将新序列放入可排序表中

时间:2015-07-08 20:33:31

标签: jquery jquery-ui jquery-ui-sortable

我把这个JSfiddle放在一起,以帮助更好地解释我需要的东西。

我创建了一个类似的表格,列出了我们系统中的所有工单。我创建了一个表单,以便能够对工作顺序(优先级)进行排序。我添加了Sortable插件,我可以将所有内容拖放到位。

但是,我无法弄清楚如何将新序列放入INPUT字段我称之为“序列”

在Steven Ray的Avtex博客示例中,我可以完成所需的一切,除了更改此行:

//Renumber table rows
function renumber_table(tableID) {
    $(tableID + " tr").each(function() {
        count = $(this).parent().children().index($(this)) + 1;
        //alert(count);

        //$(this).find('.priority').html(count);  <--- Original Line

    //////  This is where I'm trying to select the INPUT field, 
    //////  and place the value of count into it.  Obviously this is not 
    //////  working, but I cannot figure out the correct line.

        $(this).find('.priority').("input").val(count);
});
}

提前感谢您帮助治愈我的无知。

JP in KC

1 个答案:

答案 0 :(得分:0)

感谢Hackerman让JSFiddle工作!

我的问题的答案是:

$(this).find('.priority :input').val(count);

JSFiddle已更新,以显示其工作原理。

感谢Hackerman为我提供了解决我自己问题的工具。

由于 JP在KC