更新时间:2023-11-10 07:52:09
请明确@ZsoltGyöngyösi给出的答案:
Just to be clear with the answer @ZsoltGyöngyösi gave:
每个具有
id
字段的元素都需要ng-model ="$ parent.row.field"
因此,如果您通过以下方式设置 queryRowTemplate.hml
,则会删除正确的行:
Thus, the correct row will be deleted if you setup queryRowTemplate.hml
this way:
<div class="form-group col-md-3">
<label for="selectedField">Select Field</label>
<select id="selectedField" class="form-control" ng-model="$parent.row.field">
<option>title</option>
<option>application</option>
<option>subject</option>
<option>filetype</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="logicalOperator">Logical Operator</label>
<select id="logicalOperator" class="form-control" ng-model="$parent.row.logical">
<option>equal to</option>
<option>not equal to</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="searchText">Search</label>
<input id="searchText" class="form-control" type="text" placeholder="search..." ng-model="$parent.row.search" />
</div>
<div class="form-group col-md-3">
<label for="operator">Operator (optional)</label>
<select id="operator" class="form-control" ng-model="$parent.row.operator">
<option value=""></option>
<option>AND</option>
<option>OR</option>
</select>
</div>
<button class="btn btn-default" ng-click="addRqst()" type="submit">Add Row</button>
<button class="btn btn-default" ng-click="removeRqst($parent.row)" type="submit">Delete Row</button>
{{$parent.$index}}
<hr />