tui.calendar icon indicating copy to clipboard operation
tui.calendar copied to clipboard

Customize popup

Open NagarRahul opened this issue 3 years ago • 7 comments

Hi everyone, I want to customize the popup dialog according to me. I want to add more fields to that UI. Can you please help me? @cybaek @shiren @apcro @mariusa image

Version

Write the version that you are currently using.

Development Environment

Write the browser type, OS and so on.

Current Behavior

Write a description of the current operation. You can add sample code, 'CodePen' or 'jsfiddle' links.

// Write example code

Expected Behavior

Write a description of the future action.

NagarRahul avatar May 24 '21 13:05 NagarRahul

There is no customizable option for popups. If you want it, you can fork this and edit it. See these sources.

https://github.com/nhnent/tui.calendar/blob/master/src/js/view/popup/scheduleCreationPopup.js https://github.com/nhnent/tui.calendar/blob/master/src/js/view/template/popup/scheduleCreationPopup.hbs https://github.com/nhnent/tui.calendar/blob/master/src/js/view/popup/scheduleDetailPopup.js https://github.com/nhnent/tui.calendar/blob/master/src/js/view/template/popup/scheduleDetailPopup.hbs

otherwise,

You can use your own popup to display and create schedules. To disable default popup, use the options useCreationPopup=false, useDetailPopup=false.

var cal = new Calendar('#calendar', {
    useCreationPopup: false,
    useDetailPopup: false,
...
});

And when you get the event beforeCreateSchedule, you would display a popup for creating a schedule. And when you get the event 'clickSchedule', you would display a popup for displaying a schedule.

// event handlers
cal.on({
    'clickSchedule': function(e) {
        console.log('clickSchedule', e);
    },
    'beforeCreateSchedule': function(e) {
        console.log('beforeCreateSchedule', e);
        // open a creation popup (your custom popup)!!
    },
    'beforeUpdateSchedule': function(e) {
        console.log('beforeUpdateSchedule', e);
        e.schedule.start = e.start;
        e.schedule.end = e.end;
        cal.updateSchedule(e.schedule.id, e.schedule.calendarId, e.schedule);
    },
    'beforeDeleteSchedule': function(e) {
        console.log('beforeDeleteSchedule', e);
        cal.deleteSchedule(e.schedule.id, e.schedule.calendarId);
    }
});

jungeun-cho avatar May 27 '21 13:05 jungeun-cho

if i want to creat own popup to display and create schedules, How can I solve the problem of popup positioning.

bigcatLiu avatar Mar 14 '22 06:03 bigcatLiu

@bigcatLiu

You can get the guide element of selection from the event object passed as an argument from the beforeCreateSchedule event.

There is a difference between the week/day view and the month view.

In the month view

cal.on('beforeCreateSchedule' (e) => {
  // It's an object. key is the index of the row, and the value is the guide element.
  const guideElemenets = e.guide.guideElements
});

In the week view

cal.on('beforeCreateSchedule' (e) => {
  const guideElemenet = e.guide.guideElement // The guide element itself.
});

Then you can get the position of the guide element(s) using getBoundingClientRect.

adhrinae avatar Mar 15 '22 00:03 adhrinae

e.guide.guideElements

hello, thanks for your reply! i'm try, but There is this mistake! image

Uncaught TypeError: e.guide.guideElements.getBoundingClientRect is not a function

i dont know why?

bigcatLiu avatar Mar 15 '22 05:03 bigcatLiu

@bigcatLiu

I left the comment about the e.guide.guideElements like below:

It's an object. the key is the index of the row, and the value is the guide element.

You're trying to call getBoundingClientRect to a completely different object. Take a look at the value of the e.guide.guideElements then you'll get the hint.

adhrinae avatar Mar 15 '22 05:03 adhrinae

Is this also valid for the version 2.1.3? I want to open my own modal on the event creation, and perform other actions on delete and on update. Thank you

MarGraz avatar Nov 22 '22 17:11 MarGraz

@adhrinae @bigcatLiu How can we bring pop-up form through any external button?

rohit21755 avatar Jul 08 '23 12:07 rohit21755