test confirm

This commit is contained in:
Yubing325
2020-06-15 11:42:04 -05:00
parent 4d73c7c608
commit 49a647c88e
22 changed files with 285 additions and 109 deletions
@@ -21,20 +21,25 @@
<ng-container psDataGridCol="actions">
<ng-container *psDataGridColHeader>Actions</ng-container>
<ng-container *psDataGridCell="let model">
<button class="btn-success btn" psbxFormGroupCommandModal
<button class="btn-success btn" psbxFormGroupCommandModal [commandTitle]="'Change ' + model.name + ' name'" commandText="Update"
[dataSource]="merchantDataSource" command="changeMerchant" (formCreate)="onFormCreate($event)" [model]="model" [template]="theModal">Change</button>
<button class="btn-danger btn" psbxFormGroupCommandModal
[commandTitle]="'remove ' + model.name + ' name'" commandText="delete"
[dataSource]="merchantDataSource" command="removeMerchant"
[model]="model" (formCreate)="onFormCreate($event)">Remove Merchant</button>
[model]="model" (formCreate)="onFormCreate($event)">Remove</button>
<!-- <button class="btn-danger btn" psbxExecuteCommand [dataSource]="merchantDataSource" [command]="removeMerchant"
[model]="model" [confirm]="true" [confirmMessage]="do you wish to delete the merchant `' + model.name + '`" [refresh]="false">Delete</button> -->
</ng-container>
</ng-container>
<ng-container *psDataGridFooter>
<psbx-ds-pagination [dataSource]="merchantDataSource" [pages]="pages"></psbx-ds-pagination>
<psbx-ds-pagination [dataSource]="merchantDataSource"></psbx-ds-pagination>
</ng-container>
</ps-data-grid>
<ng-template #theModal let-form let-loading="loading">
<form [formGroup]="form">
<div class="form-group">
@@ -31,8 +31,7 @@ export class FormGroupModalDemoComponent implements OnInit {
});
}
onFormCreate(event: IModelFormCreateEvent) {
debugger;
onFormCreate(event: IModelFormCreateEvent) {
event.shouldSetCommandModel = false;
event.formGroup = this.fb.group({
'name': [event.commandModel.name, Validators.required],
@@ -41,18 +40,5 @@ export class FormGroupModalDemoComponent implements OnInit {
}
newMerchant(name: string) {
this.merchantDataSource.executeCommandByName('addMerchant', {
name: name
}).subscribe(
res => {
alert('it worked!');
this.merchantDataSource.refresh();
},
err => {
console.log(err);
alert('failed');
}
);
}
}