如何在 Aurelia 对话框中实现 Kendo 网格?当我单击应用程序中的按钮时,会出现一个对话框,但是如何将我的数据传输到该对话框?
这是我的发货详细信息页面的一部分,单击剑道网格内的按钮时,对话框成功打开
clickInventory() {
var self = this;
$('#reservations .au-target.k-button').on('click', function (e) {
//OrderLineKey opvragen van het item waarop werd geklicked
var itemCode = $('#reservations .k-grid').data("kendoGrid").dataItem($(e.currentTarget).closest("tr")).ItemCode;
console.log(itemCode);
(self.dialogService).open({ viewModel: InventoryDialog}).then(response => {
if (!response.wasCancelled) {
this.datasource = {
transport: {
read: '//localhost:8741/BatchBirdService/json/GetInventory/' + itemCode
},
pageSize: 5
};
/*self.http.fetch('http://localhost:8741/BatchBirdService/json/GetInventory/' + itemCode, {
method: "delete"
})/*.then(response => {
self.updateContacts();
});*/
}
});
});
}
库存对话框.html
<template>
<ai-dialog>
<ai-dialog-body>
<h3>IT WORKS ${inventory.ItemCode}</h3>
<ak-grid id="inventory" k-data-source.bind="datasource" k-pageable.bind="pageable" k-sortable.bind="true" k-selectable="row">
<ak-col k-field="Quantity"></ak-col>
<ak-col k-field="Warehouse"></ak-col>
<ak-col k-title="Warehouse Location" k-field="WarehouseLocation"></ak-col>
<ak-col k-field="Lot"></ak-col>
<ak-col k-title="Expiration Date" k-field="ExpirationDate"></ak-col>
</ak-grid>
</ai-dialog-body>
<ai-dialog-footer>
<button class="btn btn-default" click.trigger="controller.cancel()">Cancel</button>
<button class="btn btn-primary" click.trigger="controller.ok()">Delete Contact</button>
</ai-dialog-footer>
</ai-dialog>
库存对话.ts
import {inject} from "aurelia-framework";
import {DialogController} from "aurelia-dialog";
@inject(DialogController)
export class InventoryDialog {
inventory: any;
constructor(private controller: DialogController) {
this.controller = controller;
}
activate(inventory) {
this.inventory = inventory;
}
}