this.gridApi.setDomLayout('print'); is not a function












0















Referred example from Printing section of ag-grid documentation (https://www.ag-grid.com/javascript-grid-for-print/).
This is the snippet from typescript file .



         onBtPrint(){
var gridApi = this.gridApi;
this.setPrinterFriendly(gridApi);
setTimeout(function() {
print();
this.setNormal(gridApi);
}, 2000);
}
setPrinterFriendly(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "";
(eGridDiv as HTMLElement).style.height = "";
this.gridApi.setDomLayout("print");
}
setNormal(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "600px";
(eGridDiv as HTMLElement).style.height = "200px";
this.gridApi.setDomLayout("print");
}
Below is my html template , on clicking print button i am trying
to call onBtPrint()

<button (click)="onBtPrint()">print</button>
<div class="bx--row" [ngStyle]="style">
<div class="bx--col-md-12" >
<ag-grid-angular #agGrid style="width: 100%; height: 600px;" class="ag-theme-balham my-grid" id="myGrid"

[gridOptions]="gridOptions"
[columnDefs]="columnDefs"
[rowData]="rowData"
[defaultColDef]="defaultColDef"
[domLayout]="domLayout"
(gridReady)="onReady($event)"
</ag-grid-angular>
<div>
<input style= "opacity:0" readonly #modal>
</div>
</div>
Which version of ag-grid should i use .









share|improve this question

























  • This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

    – Jitendra G2
    Jan 2 at 6:01











  • I am using angular 6 , ag-grid version 18.1 ,

    – Ila Baskaran
    Jan 2 at 7:35






  • 1





    Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

    – JB Nizet
    Jan 2 at 8:59













  • Possible duplicate of How to access the correct `this` inside a callback?

    – JB Nizet
    Jan 2 at 9:01











  • did the changes does'nt seem to work , in which version of ag-grid print is supported ?

    – Ila Baskaran
    Jan 2 at 9:36
















0















Referred example from Printing section of ag-grid documentation (https://www.ag-grid.com/javascript-grid-for-print/).
This is the snippet from typescript file .



         onBtPrint(){
var gridApi = this.gridApi;
this.setPrinterFriendly(gridApi);
setTimeout(function() {
print();
this.setNormal(gridApi);
}, 2000);
}
setPrinterFriendly(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "";
(eGridDiv as HTMLElement).style.height = "";
this.gridApi.setDomLayout("print");
}
setNormal(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "600px";
(eGridDiv as HTMLElement).style.height = "200px";
this.gridApi.setDomLayout("print");
}
Below is my html template , on clicking print button i am trying
to call onBtPrint()

<button (click)="onBtPrint()">print</button>
<div class="bx--row" [ngStyle]="style">
<div class="bx--col-md-12" >
<ag-grid-angular #agGrid style="width: 100%; height: 600px;" class="ag-theme-balham my-grid" id="myGrid"

[gridOptions]="gridOptions"
[columnDefs]="columnDefs"
[rowData]="rowData"
[defaultColDef]="defaultColDef"
[domLayout]="domLayout"
(gridReady)="onReady($event)"
</ag-grid-angular>
<div>
<input style= "opacity:0" readonly #modal>
</div>
</div>
Which version of ag-grid should i use .









share|improve this question

























  • This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

    – Jitendra G2
    Jan 2 at 6:01











  • I am using angular 6 , ag-grid version 18.1 ,

    – Ila Baskaran
    Jan 2 at 7:35






  • 1





    Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

    – JB Nizet
    Jan 2 at 8:59













  • Possible duplicate of How to access the correct `this` inside a callback?

    – JB Nizet
    Jan 2 at 9:01











  • did the changes does'nt seem to work , in which version of ag-grid print is supported ?

    – Ila Baskaran
    Jan 2 at 9:36














0












0








0








Referred example from Printing section of ag-grid documentation (https://www.ag-grid.com/javascript-grid-for-print/).
This is the snippet from typescript file .



         onBtPrint(){
var gridApi = this.gridApi;
this.setPrinterFriendly(gridApi);
setTimeout(function() {
print();
this.setNormal(gridApi);
}, 2000);
}
setPrinterFriendly(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "";
(eGridDiv as HTMLElement).style.height = "";
this.gridApi.setDomLayout("print");
}
setNormal(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "600px";
(eGridDiv as HTMLElement).style.height = "200px";
this.gridApi.setDomLayout("print");
}
Below is my html template , on clicking print button i am trying
to call onBtPrint()

<button (click)="onBtPrint()">print</button>
<div class="bx--row" [ngStyle]="style">
<div class="bx--col-md-12" >
<ag-grid-angular #agGrid style="width: 100%; height: 600px;" class="ag-theme-balham my-grid" id="myGrid"

[gridOptions]="gridOptions"
[columnDefs]="columnDefs"
[rowData]="rowData"
[defaultColDef]="defaultColDef"
[domLayout]="domLayout"
(gridReady)="onReady($event)"
</ag-grid-angular>
<div>
<input style= "opacity:0" readonly #modal>
</div>
</div>
Which version of ag-grid should i use .









share|improve this question
















Referred example from Printing section of ag-grid documentation (https://www.ag-grid.com/javascript-grid-for-print/).
This is the snippet from typescript file .



         onBtPrint(){
var gridApi = this.gridApi;
this.setPrinterFriendly(gridApi);
setTimeout(function() {
print();
this.setNormal(gridApi);
}, 2000);
}
setPrinterFriendly(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "";
(eGridDiv as HTMLElement).style.height = "";
this.gridApi.setDomLayout("print");
}
setNormal(gridApi) {
var eGridDiv = document.querySelector(".my-grid");
(eGridDiv as HTMLElement).style.width = "600px";
(eGridDiv as HTMLElement).style.height = "200px";
this.gridApi.setDomLayout("print");
}
Below is my html template , on clicking print button i am trying
to call onBtPrint()

<button (click)="onBtPrint()">print</button>
<div class="bx--row" [ngStyle]="style">
<div class="bx--col-md-12" >
<ag-grid-angular #agGrid style="width: 100%; height: 600px;" class="ag-theme-balham my-grid" id="myGrid"

[gridOptions]="gridOptions"
[columnDefs]="columnDefs"
[rowData]="rowData"
[defaultColDef]="defaultColDef"
[domLayout]="domLayout"
(gridReady)="onReady($event)"
</ag-grid-angular>
<div>
<input style= "opacity:0" readonly #modal>
</div>
</div>
Which version of ag-grid should i use .






angular






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 8:55







Ila Baskaran

















asked Jan 2 at 5:52









Ila BaskaranIla Baskaran

12




12













  • This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

    – Jitendra G2
    Jan 2 at 6:01











  • I am using angular 6 , ag-grid version 18.1 ,

    – Ila Baskaran
    Jan 2 at 7:35






  • 1





    Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

    – JB Nizet
    Jan 2 at 8:59













  • Possible duplicate of How to access the correct `this` inside a callback?

    – JB Nizet
    Jan 2 at 9:01











  • did the changes does'nt seem to work , in which version of ag-grid print is supported ?

    – Ila Baskaran
    Jan 2 at 9:36



















  • This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

    – Jitendra G2
    Jan 2 at 6:01











  • I am using angular 6 , ag-grid version 18.1 ,

    – Ila Baskaran
    Jan 2 at 7:35






  • 1





    Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

    – JB Nizet
    Jan 2 at 8:59













  • Possible duplicate of How to access the correct `this` inside a callback?

    – JB Nizet
    Jan 2 at 9:01











  • did the changes does'nt seem to work , in which version of ag-grid print is supported ?

    – Ila Baskaran
    Jan 2 at 9:36

















This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

– Jitendra G2
Jan 2 at 6:01





This information are not enough. Please share some more details what the angular version, ag-grid version and required code.

– Jitendra G2
Jan 2 at 6:01













I am using angular 6 , ag-grid version 18.1 ,

– Ila Baskaran
Jan 2 at 7:35





I am using angular 6 , ag-grid version 18.1 ,

– Ila Baskaran
Jan 2 at 7:35




1




1





Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

– JB Nizet
Jan 2 at 8:59







Stop using anonymous functions. use arrow functions. setTimeout(() => { ... }) And define your setPrinterFriendly and setNormal functions as private methods of your component.

– JB Nizet
Jan 2 at 8:59















Possible duplicate of How to access the correct `this` inside a callback?

– JB Nizet
Jan 2 at 9:01





Possible duplicate of How to access the correct `this` inside a callback?

– JB Nizet
Jan 2 at 9:01













did the changes does'nt seem to work , in which version of ag-grid print is supported ?

– Ila Baskaran
Jan 2 at 9:36





did the changes does'nt seem to work , in which version of ag-grid print is supported ?

– Ila Baskaran
Jan 2 at 9:36












1 Answer
1






active

oldest

votes


















0














Which your using ag-grid 18.1 api doesn't introduced setDomlayout property. So you just need to update ag-Grid to v20 for this functionality.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001831%2fthis-gridapi-setdomlayoutprint-is-not-a-function%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Which your using ag-grid 18.1 api doesn't introduced setDomlayout property. So you just need to update ag-Grid to v20 for this functionality.






    share|improve this answer




























      0














      Which your using ag-grid 18.1 api doesn't introduced setDomlayout property. So you just need to update ag-Grid to v20 for this functionality.






      share|improve this answer


























        0












        0








        0







        Which your using ag-grid 18.1 api doesn't introduced setDomlayout property. So you just need to update ag-Grid to v20 for this functionality.






        share|improve this answer













        Which your using ag-grid 18.1 api doesn't introduced setDomlayout property. So you just need to update ag-Grid to v20 for this functionality.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 21 at 15:09









        Sp RajuSp Raju

        210315




        210315
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001831%2fthis-gridapi-setdomlayoutprint-is-not-a-function%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith