bind带autocomplete时,最好是从新的tr复制

来源:互联网 发布:梦幻之星nova捏脸数据 编辑:程序博客网 时间:2024/06/05 03:40
(function($) {
//自动关联ItemNo
$.fn.extend({
productitemlist: function(options) {
return this.each(function() {
var>var>sender.unautocomplete()
.autocomplete(url, {
max: 0
,minChars: 1
,width: 420
,matchContains: "word"
,autoFill: false
,extraParams: {
}
,formatItem: function(row){return row[1];}
,formatResult: function(row){return row[1];}


})
.result(function(event, data, formatted) {
var>if(data) tr.find("input[name=itemno]").val(data[0]).change();
if(data) tr.find("input[name=product]").val(data[3]);
});
});
}


});
//自动关联ItemNo

})(jQuery);





//+ - 
function changeRows_sample(sender,desc){
var>var>if(desc<0){
if(table.find("tr").length>1){
tr.remove();
//table.find("tr").eq(0).find("input[type=button]").button();  //不知为何remove会使第一行button失去样式
}else{
tr.find("input[type=text]").val("");
tr.find("input[type=checkbox]").removeAttr("checked");
tr.find(".expend").html("");
tr.closest("tr").find(".gps").html("");
}
}else{
var>$(tr).after(newrow);
newrow.find("input[type=text]").val("");
newrow.find("input[type=checkbox]").removeAttr("checked");
newrow.find(".expend").html("");
newrow.find(".gps").html("");
newrow.find("input[name=itemno]").attr("id",Math.random());
newrow.find("input[name=itemno]").productitemlist();
newrow.find("input[name=itemno]").bind("change",itemno_change);
}
}


.asp页面中



<table><tr>
<td>
<input></td>
<td><input></td>
<td><input><td><td><span></td>
<td><span></td>
<td><input><input></td>
</tr>
</table>

0 0