twinssbc / Ionic2-Calendar

A calendar component based on Ionic framework
https://ionic-calendar-demo.stackblitz.io
MIT License
390 stars 199 forks source link

Current Month view export #396

Closed patrickritskes closed 4 years ago

patrickritskes commented 5 years ago

Hi there,

Right now i'm busy with a event PDF export, all is working well!

But the idea is to do a monhtly PDF export from the current month view (let's say November) with all it's available events from that specific month.

How can this be done? I already did a try with the onRangeChanged event with queryMode to 'remote' with no luck

twinssbc commented 5 years ago

@patrickritskes The calendar accepts the events you passed in, so you should already know the available events within the time range, no need to let the calendar tell you the available events.

felimoles commented 5 years ago

you need get the arrays of the month (array 7* 4 or 5), maybe is not possible... you use pdfmake?

patrickritskes commented 5 years ago

Hi,

Yes I make use of pdfMake at the moment.

I know already all the events off course, but need a way to figure out in which month view i'm looking at

Op di 18 dec. 2018 om 15:17 schreef x notifications@github.com:

you need get the arrays of the month (array 7* 4 or 5), maybe is not possible... you use pdfmake?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twinssbc/Ionic2-Calendar/issues/396#issuecomment-448235252, or mute the thread https://github.com/notifications/unsubscribe-auth/AKANIvGUbSZ3zydmj7Vpx0kaWosF9ttpks5u6Pj1gaJpZM4ZVRm4 .

felimoles commented 5 years ago

the ng-template contain the arrays

<ng-template #template let-view="view" let-row="row" let-col="col"> {{view.dates[row*7+col].label}} </ng-template> <calendar ... [monthviewDisplayEventTemplate]="template"></calendar> see de doc...

if you get the view (console.log(view.dates)); maybe solve your problem, i don't know how to do that.

patrickritskes commented 5 years ago

I will give it a try, many thanks for your approach! Will let you know asap

Op di 18 dec. 2018 15:52 schreef x notifications@github.com:

the ng-template contain the arrays

`<ng-template #template let-view="view" let-row="row" let-col="col"> {{view.dates[row*7+col].label}}

<calendar ... [monthviewDisplayEventTemplate]="template"></calendar>`

see de doc...

if you get the view (console.log(view.dates)); maybe solve your problem, i don't know how to do that.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twinssbc/Ionic2-Calendar/issues/396#issuecomment-448246627, or mute the thread https://github.com/notifications/unsubscribe-auth/AKANIum00_PB0KvjdxjD_XqHf580D5YIks5u6QEngaJpZM4ZVRm4 .

felimoles commented 5 years ago

ok, i get the arrays

add the template month in your html, and use Viewchild my code

... all import...
export class HomePage {
  @ViewChild('templatemonth') elemElem;
... other code

html

 <ng-template #templatemonth let-view="view" let-row="row" let-col="col">
<div class="custom-month-day" (ionChange)="getView(view)">{{view.dates[row*7+col].label}}</div>
 </ng-template>
<calendar
 [monthviewDisplayEventTemplate]="templatemonth"
... rest of code

use "console.log(this.elemElem);" in some function (button for example) for get data, and you see all arrays of the month, the info is confused, but you can build a calendar

captura de pantalla 2018-12-18 a la s 12 24 59

edit: change image

patrickritskes commented 5 years ago

Ah ok I see! Looks promising!

Op di 18 dec. 2018 16:24 schreef x notifications@github.com:

ok, i get the arrays

add the template month in your html, and use Viewchild my code

... all import... export class HomePage { @ViewChild('templatemonth') elemElem; ... other code use "console.log(this.elemElem);" in some function (button for example) for get data, and you see all arrays of the month, the info is confused, but you can build a calendar

[image: captura de pantalla 2018-12-18 a la s 12 23 52] https://user-images.githubusercontent.com/801562/50163723-d78f1b80-02bf-11e9-9133-07ab52fd4254.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twinssbc/Ionic2-Calendar/issues/396#issuecomment-448257940, or mute the thread https://github.com/notifications/unsubscribe-auth/AKANInYSZrwGIWSkCurpQkyn8Upn39U2ks5u6QivgaJpZM4ZVRm4 .

patrickritskes commented 5 years ago

Got it al working now, nice PDF export of my montly viewed events!

Only 1 thing left: if you have a montview of December, you still got some days from November and Januari in the actual monthview unfortunately!

Op di 18 dec. 2018 om 17:19 schreef Patrick Ritskes < patrickritskes@gmail.com>:

Ah ok I see! Looks promising!

Op di 18 dec. 2018 16:24 schreef x notifications@github.com:

ok, i get the arrays

add the template month in your html, and use Viewchild my code

... all import... export class HomePage { @ViewChild('templatemonth') elemElem; ... other code use "console.log(this.elemElem);" in some function (button for example) for get data, and you see all arrays of the month, the info is confused, but you can build a calendar

[image: captura de pantalla 2018-12-18 a la s 12 23 52] https://user-images.githubusercontent.com/801562/50163723-d78f1b80-02bf-11e9-9133-07ab52fd4254.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twinssbc/Ionic2-Calendar/issues/396#issuecomment-448257940, or mute the thread https://github.com/notifications/unsubscribe-auth/AKANInYSZrwGIWSkCurpQkyn8Upn39U2ks5u6QivgaJpZM4ZVRm4 .

twinssbc commented 5 years ago

@patrickritskes You could use onCurrentDateChanged callback. That date definitely falls into the current displayed month.

patrickritskes commented 5 years ago

@twinssbc/Ionic2-Calendar reply@reply.github.com I only get the selected date back when using onCurrentDateChanged! not the whole calendar range, am I missing something here?

Op wo 19 dec. 2018 om 16:16 schreef twinssbc notifications@github.com:

@patrickritskes https://github.com/patrickritskes You could use onCurrentDateChanged callback. That date definitely falls into the current displayed month.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/twinssbc/Ionic2-Calendar/issues/396#issuecomment-448630917, or mute the thread https://github.com/notifications/unsubscribe-auth/AKANIstkxqbwMaH3GK0rpTRkvuK8a4Mbks5u6lhcgaJpZM4ZVRm4 .

twinssbc commented 5 years ago

@patrickritskes I thought you just want to know what's the current month?

felimoles commented 5 years ago

he need print the calendar in a pdf, using html2canvas isnt posibble (create a screenshot), then he needs get all arrays to create the calendar using only arrays