allBondedWarehouse1: any;
通过这种方式,有一种符合任何类型的变体
this.allBondedWarehouse = new DataSource({
load: (loadOptions) => {
return this.service.getBondedWarehouseTrioKeyValueGridData(null).toPromise().then(response => {
debugger;
this.allBondedWarehouse1 = response;
//this.allBondedWarehouse1 = new ArrayStore({
// data: response,
// key: 'id'
//});
this.bondedWarehouseIdsStirng = this.requestModel.bondedWarehouseIds.split(',');
for (var item in this.bondedWarehouseIdsStirng) {
if (parseInt(item)) {
//this.allBondedWarehouseGridData.push(item);
this.addBondedWarehouse(parseInt(item));
}
}
return response;
}
)
}
});
我做了几个步骤,然后抛出了变量返回变量。
<div class="form-group" [hidden]="isImportCreate">
<bl-atlas-common-bonded-warehouse-grid [placeHolder]="'Antrepo'"
[(bindModel)]="requestModel.bondedWarehouseId"
[isValidated]="true"
(customHouseIdChange)="customHouseIdChange($event)"
(bindModelChange)="addBondedWarehouse($event)"></bl-atlas-common-bonded-warehouse-grid>
我使用此组件bindModelChange触发方法。
addBondedWarehouse(event) {
var bw = this.allBondedWarehouse1.filter(x => x.id === event).allBondedWarehouse1_types;
debugger;
if (bw != null) {
if (this.allBondedWarehouseGridData.filter(x => x.id == bw.id).length == 0) {
this.allBondedWarehouseGridData.push(bw);
this.addOfferBondedWarehouseList.push(bw.id);
}
}
//this.requestModel.customHouseIds = null;
}
我无法过滤此行。
在此图中,如果bw变量未定义且x =&gt; x.id未定义,你能帮忙吗?
答案 0 :(得分:0)
我解决了这个问题。我花了一段时间,我用另一个区域填充当前序列。
var bw = this.allBondedWarehouse1.filter(x => x.id == event.id);
上面的代码片段解决了我的问题。感谢您的时间。我希望没有人会陷入如此明显的错误,即使你犯了错误也不会浪费那么多时间。