We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Problem with Grid print

Hi there
I have problem with print functionality 

when I call the grid.print()
I came to following error :

Is there any things further I should consider? I'd just followed the examples...
TypeError: Cannot read property 'moveTo' of null
  75 | Print.prototype.print = function () {
76 | this.renderPrintGrid();
77 | this.printWind = window.open('', 'print', 'height=' + window.outerHeight + ',width=' + window.outerWidth + ',tabbar=no');
> 78 | this.printWind.moveTo(0, 0);
| ^ 79 | this.printWind.resizeTo(screen.availWidth, screen.availHeight);
80 | };
81 |
  2598 | 
2599 | Grid.prototype.print = function () {
2600 | if (this.printModule) {
> 2601 | this.printModule.print();
| ^ 2602 | }
2603 | };
2604 | /**
  50 |             this.grid.csvExport();
51 | break;
52 | case 'Print':
> 53 | this.grid.print();
| ^ 54 | break;
55 | }
56 | }

4 Replies

HJ Hariharan J V Syncfusion Team April 4, 2019 12:19 PM UTC

Hi Ali Rahighi, 

As we have validated the your query provided the information and we suspect that script error(“TypeError: Cannot read property 'moveTo' of null”) thrown when we print the our EJ2 Grid even the browser were block the pop-up in corresponding page. We suggest you to ensure the browser pop-up state change or not while the Print the EJ2 Grid. For your reference we have share the issue reproduced the screenshot with cause of that defect too. 


Please get back to us, if you need further assistance. 


AR Ali Rahighi April 4, 2019 07:27 PM UTC

Thanks for your attention Hariharan J V
The debugging information I've provided is for when I use chrome debug and putting break point on grid.print() code and step by step debugging  in vs code
On the other hand without any break points there is different error in browser console and that's this :

      I must add pop up is allowed because an empty  print page opens when I click the print button

AR Ali Rahighi April 4, 2019 08:34 PM UTC

I think I found it!!
And it seems it's a BUG
because when I set the allowGrouping to TRUE this happens to me.
you can reproduce the bug just by adding allowGrouping={true} (and do not add the Group service in Inject tag)
this was remained lonely after I removed the Group service injection.
It's better to fix this issue it took me a long time :))

HJ Hariharan J V Syncfusion Team April 5, 2019 06:57 AM UTC

Hi Ali Rahighi, 
Thanks for your update. 
This is not a bug. This is the default behavior which we have stated already in our Documentation. In order to use grouping  We must need to inject the grouping service. Otherwise it may not work. So we suggest you to Inject the required services before using a feature. 
Please refer the following documentation more information: 

Live Chat Icon For mobile
Up arrow icon