1
我有这个表和事先键入的内容第一个单元格选择
<table id="vehicleParamTable" class="table table-striped">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
当一个链接的点击,我添加一行。这很好。
在该行的第一列中,我添加的jquery-typehead
选择器不工作,也想避免它为第一行(th头)
$('#vehicleParamTable tr td:first-child').typeahead({
minLength: 2,
display: "name",
mustSelectItem: true,
emptyTemplate: function(query) {
//must reset current element here
return 'No result for "' + query + '"';
},
source: {
vehicleParam: {
ajax: {
url: "/rest/vehicleparam",
path: "content"
}
}
},
callback: {
onEnter: function(node, a, item, event) {
//must assign item.id to current current element id
},
onResult: function(node, query, result, resultCount, resultCountPerGroup) {
if (resultCount < 1) {
//must reset current element here
}
}
}
});
编辑
$('#vehicleParamTable tr td:first-child')
似乎不错,但与返回undefined
其余的(预输入初始化..)编辑2因为我动态添加行,需要刷新打字头...