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因爲我動態添加行,需要刷新打字頭...