在Gird里添加
protected getColumns() {
columns.unshift({
field: 'Maintain',
name: 'Maintain',
format: ctx => '<a class="inline-action Maintain" title="Maintain">' +
'<i class="fa fa-wrench text-teal"></i></a>',
width: 24,
minWidth: 24,
maxWidth: 24
});
}
点击后弹出对话框
protected onClick(e: JQueryEventObject, row: number, cell: number): void {
var self = this;
// let base grid handle clicks for its edit links
super.onClick(e, row, cell);
// if base grid already handled, we shouldn"t handle it again
if (e.isDefaultPrevented()) {
return;
}
// get reference to current item
var item = this.itemAt(row);
// get reference to clicked element
var target = $(e.target);
// if user clicks "i" element, e.g. icon
if (target.parent().hasClass('inline-action'))
target = target.parent();
if (target.hasClass("inline-action")) {
e.preventDefault();
if (target.hasClass("Maintain")) {
self.rootCauseRecordDialog = new RootCauseRecordDialog();
var entity: RootCauseRecordRow = {};
entity.Sales = item.Sales;
entity.ProdOrder = item.Productorder;
self.rootCauseRecordDialog.loadEntityAndOpenDialog(entity);
}
}
}