Hi,
I have Test1 Page in which there is dropdown which has Footer as "Add New" button from which I can open Test2 page as Kendo Window so that I can add records using Test2 Page and it should be display to dropdownlist. I am using typescript. I am able to add the record and I can see that comes to dropdownlist as well but I want to close the kendo window once it creates a record. I tried window.close on Test2 Page but it says script cannot close page when they are open. I know window.close() is not the right way to do it. I should be able to get the control (KendowWindow) on Test2 page and close the kendo window. Can you please help?
Thanks
Here is code -
Test1.html
<div>
<label for="ddCedent">Cedent<span class="reqfield">*</span></label>
<kendo-dropdownlist #ancCedent [defaultItem]="{name: 'Select cedent...', businessPartnerNumber: null}" formControlName="cedent" [data]="cedents" [filterable]="true"
[textField]="'name'" [valueField]="'id'" [valuePrimitive]="true" class="form-control" [ngClass]="{ 'ng-invalid ng-touched': submitted && this.formControls.cedent.errors }">
<ng-template kendoDropDownListItemTemplate let-dataItem>
{{dataItem.name}} {{dataItem.businessPartnerNumber}}
</ng-template>
<ng-template kendoDropDownListFooterTemplate>
<table><tr><td></td><td style="float:right"><button kendoButton *ngIf="!openedAccount" (click)="showWindow()">Add New</button></td></tr></table>
</ng-template>
</kendo-dropdownlist>
<ng-container #container1></ng-container>
<div *ngIf="submitted && this.formControls.cedent.errors" class="k-tooltip-validation">
<div class="reqfield" *ngIf="this.formControls.cedent.errors.required">ⓘ Cedent is required</div>
</div>
Test1.ts
public showWindow() {
this.opened = true;
setTimeout(() => {
const window: WindowRef = this.windowService.open({
appendTo: this.containerRef,
title: "Add Account",
content: Test2Component,
width: 800,
height: 1200,
});
window.result.subscribe((result) => {
if (result instanceof WindowCloseResult) {
this.opened = false;
this.getAccounts();
}
});
});
}