-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'width' of undefinded #105
Comments
It might me years now that I get this message. Could not find a solution.
Seems that the problem is in the code of bundle.js. I could not find any way to handle “width” in my own code.
Von: firechhe <[email protected]>
Gesendet: Sonntag, 6. Oktober 2019 20:43
An: rowanwins/leaflet-easyPrint <[email protected]>
Cc: Subscribed <[email protected]>
Betreff: [rowanwins/leaflet-easyPrint] Cannot read property 'width' of undefinded (#105)
Hello,
I want to create a Button in my bootstrap dropdown menu to print a leaflet map. So I have the following Code:
var printer = L.easyPrint({
sizeModes: ['A4Landscape'],
tileLayer: cartoLight,
hideControlContainer: true,
}) .addTo(map);
And I create a function:
$("#printer-btn").click(function() { printer.printMap('A4Landscape'); $(".navbar-collapse.in").collapse("hide"); return false; });
But now, when I click my printbutton in the dropdown menu I get the following error in my chrome console:
oops, something went wrong! TypeError: Cannot read property 'width' of undefined
at e._resizeAndPrintMap (bundle.js:1)
at bundle.js:1
What can I do? I installed the latest version from the repository.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#105?email_source=notifications&email_token=ABPGDZNP6QGQ233EIHHQDBLQNIWURA5CNFSM4I55GPIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5LATQ> , or mute the thread <https://github.com/notifications/unsubscribe-auth/ABPGDZPUFTRN3PZD2SQJ53LQNIWURANCNFSM4I55GPIA> . <https://github.com/notifications/beacon/ABPGDZIPUZ4YMDAMJ76BN33QNIWURA5CNFSM4I55GPIKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HP5LATQ.gif>
|
Oh ok. That is not good. |
I solved it by adding word page to the first argument. |
These no longer seem to be working. When using 'A4Landscape page' or 'A4Portrait page' it seems to be giving the 'oops, something went wrong! TypeError: Cannot read properties of undefined (reading 'width')' error, still. |
Oops! Nevermind, the relevant option needs to be provided to sizeModes as well! (sizeModes=['A4Portrait'] to call printMap('A4Portrait page')) |
A4Portrait page works |
Hello,
I want to create a Button in my bootstrap dropdown menu to print a leaflet map. So I have the following Code:
And I create a function:
$("#printer-btn").click(function() { printer.printMap('A4Landscape'); $(".navbar-collapse.in").collapse("hide"); return false; });
But now, when I click my printbutton in the dropdown menu I get the following error in my chrome console:
What can I do? I installed the latest version from the repository.
The text was updated successfully, but these errors were encountered: