UI of Timeline year view resetting with custom event template of appointment

This is the requirement.
Image_1808_1713340593540Before

I have used multiple resource grouping and manually set the height of cells and position of appointments with 

custom event template of appointment.

but after hovering on sidebar UI getting reset and all the manual setting CSS disappeared.Image_7910_1713340828202After hovering on Sidebar


17 Replies

RR Ram Raju Elaiyaperumal Syncfusion Team April 19, 2024 01:48 PM UTC

Hi Ravi,

Thank you for providing the details of your issue. To better assist you, we would appreciate if you could provide some additional information:


  1. Could you please elaborate on how you've customized the event? Specifically, did you use events like eventRendered or dataBound to customize the appearance or behavior of the events?

  2. Could you please share the code snippet and CSS code you used to manually set the height of cells and position of appointments? This will help us understand how you've customized the layout.

  3. If possible, could you provide issue replicating sample that replicates the issue? This would greatly help us in identifying the root cause.

Your cooperation is greatly appreciated and will help us resolve your issue more efficiently.


Regards,

Ram



RD Ravi Dudhat replied to Ram Raju Elaiyaperumal April 22, 2024 05:36 AM UTC

Hi Ram,
Thanks for your replay,

-> Hear is the code snippet of event template for appointment.

<!-- Template for Appointment -->

        <template v-slot:eventTemplate="{ data }">

          <v-card

            height="auto"

            :id="data.StartTime"

            @click="

              $router.push(`/meeting/${data.id}/agenda/tenant/${tenantId}`)

            "

            class="subject appointment-meeting-template full-width ma-1"

            tile

          >

            <v-row no-gutters class="appointment-meetingName px-1">

              {{ data.meetingName }}

            </v-row>

            <v-row

              no-gutters

              class="appointment-topic px-1 ma-1"

              v-for="(topicCat, index) in data.topicCategory"

              :key="index"

            >

              <v-col cols="12" class="topic-category text-center">{{

                topicCat.name

              }}</v-col>

              <ul class="pl-4" style="width: 100%">

                <li v-for="(topic, index) in topicCat.topics" :key="index">

                  <span class="topic">{{ topic.topicName }}</span>

                  <v-divider

                    v-if="index !== topicCat.topics.length - 1"

                  ></v-divider>

                </li>

              </ul>

            </v-row>

          </v-card>

        </template>


->  code snippet used to manually set the height of cells and position of appointments

onDataBound() {

      let scheduleObj = this.$refs.agendaScheduleObj;

      console.log("onDataBound.........", scheduleObj);

      this.setAgendaUI();

    },

setAgendaUI() {

      setTimeout(() => {

        let appointments = document.getElementsByClassName("e-appointment");

        let cells = document.getElementsByClassName(

          "e-work-cells e-child-node e-work-days"

        );

        let agendaCells = document.getElementsByClassName(

          "e-resource-cells e-child-node"

        );


        for (let c = 0; c < cells.length; c++) {

          let childrenHeight = 0;

          let cell = cells[c];

          for (let a = 0; a < appointments.length; a++) {

            let appointment = appointments[a];

            let appointmentDate = new Date(

              appointment.children[0].children[0].id

            );

            let cellDate = new Date(Number(cell.dataset.date));


            if (

              appointmentDate.getMonth() == cellDate.getMonth() &&

              appointmentDate.getFullYear() == cellDate.getFullYear() &&

              cell.dataset.groupIndex == appointment.dataset.groupIndex

            ) {

              childrenHeight += appointment.offsetHeight;

              cell.style.height = `${childrenHeight}px`;


              if (appointment.previousSibling == null) {

                appointment.style.top = `${cell.offsetTop}px`;

              } else {

                if (

                  appointment.previousSibling &&

                  appointment.parentNode.childElementCount

                ) {

                  for (

                    let i = 0;

                    i < appointment.parentNode.children.length;

                    i++

                  ) {

                    let sum = 0;

                    for (let j = 0; j < i; j++) {

                      sum += appointment.parentNode.children[j].offsetHeight;

                    }


                    appointment.parentNode.children[i].style.top = `${

                      cell.offsetTop + sum

                    }px`;

                  }

                }

              }

            } else {

              childrenHeight = 0;

            }

            // }

          }

          for (let i = 0; i < agendaCells.length; i++) {

            if (agendaCells[i].dataset.groupIndex == cell.dataset.groupIndex) {

              agendaCells[i].style.height = `${cell.offsetHeight}px`;

            }

          }

        }

        this.resizing = false;

        // console.log("resizing end", this.resizing);

      }, 100);

    },

Thanks and Regards,
Ravi



RR Ram Raju Elaiyaperumal Syncfusion Team April 29, 2024 04:21 PM UTC

Hi Ravi,

We've created a sample using a sidebar and customized events, based on the information you provided. We then tested to see if the events were misplaced when toggling the sidebar. However, we were unable to replicate the issue you're experiencing.

we have prepared a stackblitz sample, check on the sample: https://stackblitz.com/edit/schedule-with-sidebar-event-customization

It would be helpful if you could provide more details about your setup or a simple sample that replicates the issue. Alternatively, you could try to replicate the issue in the provided sample and let us know the steps you took. This will help us in identifying the root cause of the problem and provide you with a more accurate solution.





Regards,

Ram



RD Ravi Dudhat replied to Ram Raju Elaiyaperumal May 2, 2024 06:59 AM UTC

Hi Ram

Thank you for your replay,

Actually I'm using navigation-drawer of vuetify as sidebar.

component:- v-navigation-drawer


Also height of each appointment can be different, that's why using custom event template for appointment.

-> Hear is the code snippet of event template for appointment.

<!-- Template for Appointment -->

        <template v-slot:eventTemplate="{ data }">

          <v-card

            height="auto"

            :id="data.StartTime"

            @click="

              $router.push(`/meeting/${data.id}/agenda/tenant/${tenantId}`)

            "

            class="subject appointment-meeting-template full-width ma-1"

            tile

          >

            <v-row no-gutters class="appointment-meetingName px-1">

              {{ data.meetingName }}

            </v-row>

            <v-row

              no-gutters

              class="appointment-topic px-1 ma-1"

              v-for="(topicCat, index) in data.topicCategory"

              :key="index"

            >

              <v-col cols="12" class="topic-category text-center">{{

                topicCat.name

              }}</v-col>

              <ul class="pl-4" style="width: 100%">

                <li v-for="(topic, index) in topicCat.topics" :key="index">

                  <span class="topic">{{ topic.topicName }}</span>

                  <v-divider

                    v-if="index !== topicCat.topics.length - 1"

                  ></v-divider>

                </li>

              </ul>

            </v-row>

          </v-card>

        </template>

Also "eventRendered" event of Syncfusion vue Scheduler component getting triggered every time on hover and hover out side of navigation drawer of vuetify.

Packages:-

  • @syncfusion/ej2-vue-schedule": "^20.4.53"
  • "vuetify": "^2.5.10",



  • Regards,

    Ravi



RR Ram Raju Elaiyaperumal Syncfusion Team May 2, 2024 02:16 PM UTC

Hi Ravi Dudhat,

Based on the code snippets shared, we have created a similar sample using v-navigation-drawer as a sidebar, and tried to replicate the issue but unfortunately we couldn’t able to replicate the issue. It would be helpful if you could provide more details about your setup or a simple sample that replicates the issue. Alternatively, you could try to replicate the issue in the provided sample and let us know the steps you took. This will help us in identifying the root cause of the problem and provide you with a more accurate solution.


Regards,

Ram


Attachment: Schedulewithveutifysidebar_ec2a7f19.zip


RD Ravi Dudhat May 3, 2024 09:58 AM UTC

Hi Ram,

Please check this updated sample.


I'm using these Packages in my project:-

  • @syncfusion/ej2-vue-schedule": "^20.4.53"
  • "vuetify": "^2.5.10",
  • "vue": "2.6.14"



Regards,
Ravi


Attachment: Updated_Schedulewithveutifysidebar_ec2a7f19_b52f95eb.zip


RR Ram Raju Elaiyaperumal Syncfusion Team May 8, 2024 04:47 PM UTC

Hi Ravi Dudhat,

The sample you have provided also has the same version as the sample we provided. Therefore, we have prepared a similar sample in Vue 2 using the mentioned version. However, we were unable to see the issue you are experiencing. It would be helpful if you could provide a sample that replicates your issue, or you can try to modify our sample to replicate the issue. Additionally, a video demo could also be helpful in understanding your issue.

Regards,

Ram


Attachment: vuetifysidebar_f84d29a8.zip


RD Ravi Dudhat replied to Ram Raju Elaiyaperumal May 9, 2024 11:43 AM UTC

Hi  Ram Raju Elaiyaperumal,

I am sharing the video of issue facing for Syncfusion scheduler.

Regards,
Ravi


Attachment: Syncfusion_schedule_video_332ab3ac.zip


RD Ravi Dudhat May 10, 2024 01:50 PM UTC

Hi  Ram Raju Elaiyaperumal,

I am sharing the sample to replicate the issue for Syncfusion scheduler.

Regards,
Ravi


Attachment: samplesyncfusionschedulewithvue2_aeee71a1.zip


RR Ram Raju Elaiyaperumal Syncfusion Team May 14, 2024 12:06 PM UTC

Hi Ravi Dudhat,

The issue you're encountering may be related to the CSS layout of your application. When the sidebar opens, it triggers the window resize handler, which in turn updates the scheduler. However, during this process, the renderCell and dataBound events are not triggered. This means that any style changes made within these methods are not reflected, leading to the problem you're experiencing.

To resolve this issue, consider updating the scheduler's layout when the sidebar opens. This can be achieved by invoking the refresh method of the scheduler when a resize event occurs. This approach should ensure that all style changes are appropriately applied, thereby addressing the current issue.

Here's an example of how you can do this:

<script>

import Vue from "vue";

import { SchedulePlugin, TimelineYear } from "@syncfusion/ej2-vue-schedule";

Vue.use(SchedulePlugin);

export default {

  data() {

    return {

    

 

  provide: {

    schedule: [TimelineYear],

  },

  computed: {

    eventSettings() {

      return {

        template: "eventTemplate",

        dataSource: this.meetingList,

        enableTooltip: true,

      };

    },

  },

  methods: {

    handleResize() {

      if (this.$refs.scheduleObj) {

        document.querySelector(".e-schedule").ej2_instances[0].refresh();

      }

    },

  },

 

  mounted() {

    window.addEventListener('resize', this.handleResize);

  },

  beforeDestroy() {

    window.removeEventListener('resize', this.handleResize);

  },

 

  watch: {

    group() {

      this.drawer = false;

    },

  },

};

</script>


We have modified the sample, kindly check on the attached sample.

Please let us know if you need further assistance or clarification on this matter.


Regards,

Ram



RD Ravi Dudhat replied to Ram Raju Elaiyaperumal May 15, 2024 10:09 AM UTC

Hi  Ram Raju Elaiyaperumal,

I invoked the refresh method of the scheduler when a resize event occurs, as you suggested.

I am sharing the video for the Syncfusion scheduler as an attachment.


However, I don't think refreshing the scheduler every time a resize event occurs is a good approach for user experience.

Is there an any way to prevent resizing on hover in/out of sidebar?

Regards,
Ravi


Attachment: Refresh_Schedule_982943b2.zip


RD Ravi Dudhat May 23, 2024 11:46 AM UTC

Hi  Ram Raju Elaiyaperumal,

I got the one solution, for that I have removed some classes when data bound to the scheduler.

Hear I'm sharing the code.

Image_8293_1716464364627


but whenever I'm hovering on Sidebar I'm facing below console errors.
these errors are coming from node_modules Syncfusion. 
Image_8107_1716464554877

So can you please give your suggestion for this?

Thanks & Regards,

Ravi



AK Ashokkumar Karuppasamy Syncfusion Team May 23, 2024 04:12 PM UTC

Hi Ravi Dudhat,


We appreciate your patience and understanding. We have included the shared code you provided and updated the sample, but we couldn’t replicate the issues you mentioned. We have attached the videos and sample for your reference. Kindly share the details of any updated code on your end and the e-auto-height styles you applied, as this will greatly assist us in understanding and resolving the problem.

Regards,
Ashok


Attachment: samplesyncfusionschedulewithvue2__Google_Chrome_20240523_212936_9e48f9f0.zip


RD Ravi Dudhat May 24, 2024 05:57 AM UTC

Hi  Ashokkumar Karuppasamy,

I am sharing the updated sample and in this sample I have added the sample video as well to replicate the issue for better understanding.



Thanks & Regards
Ravi


Attachment: SyncfusionschedulerTImelineyearviewvue2withvideo_c324beb6.zip


AK Ashokkumar Karuppasamy Syncfusion Team May 24, 2024 01:56 PM UTC

Hi Ravi Dudhat,

Based on the shared details, we have identified the reason for the issue. Removing the scheduled element classes in the dataBound event will definitely cause problems. Therefore, based on the details, the appointment style will be customized in the dataBound event. We suggest using the same dataBound method with the resize handler event to meet your requirements.

Additionally, we recommend not adding the style in the render cells event by default. Instead, use a custom class to add and apply the styles. The schedule will not re-render, so using the custom class ensures that the styles are maintained and work properly. Please try this solution and let us know if you need any further assistance.

    onDataBound() {

      let scheduleObj = this.$refs.scheduleObj;

 

      console.log("onDataBound.........", scheduleObj);

 

      let appointments = document.getElementsByClassName("e-appointment");

      console.log("appointments", appointments);

 

      let cells = document.getElementsByClassName(

        "e-work-cells e-child-node e-work-days"

      );

 

      let agendaCells = document.getElementsByClassName(

        "e-resource-cells e-child-node"

      );

 

      for (let c = 0; c < cells.length; c++) {

        let childrenHeight = 0;

        let cell = cells[c];

        for (let a = 0; a < appointments.length; a++) {

          let appointment = appointments[a];

          let appointmentDate = new Date(

            appointment.children[0].children[0].id

          );

          let cellDate = new Date(Number(cell.dataset.date));

 

          if (

            appointmentDate.getMonth() == cellDate.getMonth() &&

            appointmentDate.getFullYear() == cellDate.getFullYear() &&

            cell.dataset.groupIndex == appointment.dataset.groupIndex

          ) {

            childrenHeight += appointment.offsetHeight;

            cell.style.height = `${childrenHeight}px`;

 

            if (appointment.previousSibling == null) {

              appointment.style.top = `${cell.offsetTop}px`;

            } else {

              if (

                appointment.previousSibling &&

                appointment.parentNode.childElementCount

              ) {

                for (

                  let i = 0;

                  i < appointment.parentNode.children.length;

                  i++

                ) {

                  let sum = 0;

                  for (let j = 0; j < i; j++) {

                    sum += appointment.parentNode.children[j].offsetHeight;

                  }

 

                  appointment.parentNode.children[i].style.top = `${

                    cell.offsetTop + sum

                  }px`;

                }

              }

            }

          } else {

            childrenHeight = 0;

          }

          // }

        }

        for (let i = 0; i < agendaCells.length; i++) {

          if (agendaCells[i].dataset.groupIndex == cell.dataset.groupIndex) {

            agendaCells[i].style.height = `${cell.offsetHeight}px`;

          }

        }

      }

    },

    handleResize() {

      this.onDataBound();

    },

  },

  mounted() {

    window.addEventListener('resize', this.handleResize);

  },

  beforeDestroy() {

    window.removeEventListener('resize', this.handleResize);

  },

 

  watch: {

    group() {

      this.drawer = false;

    },

  },

};

</script>

 


Regards,
Ashok



RD Ravi Dudhat replied to Ashokkumar Karuppasamy May 29, 2024 10:17 AM UTC

Hi  Ashokkumar Karuppasamy,

I am facing the console error whenever hover in/out of vuetify side bar.  Image_8107_1716464554877
I'm getting this error because I have removed below classes that's causing css issue (Scheduler appointments getting overlapped).
Image_4348_1716977604365  

So Is there any way to tackle this error?

I am sharing the sample and in this sample I have added the sample video as well to replicate the issue for better understanding.



Thanks & Regards,
Ravi


Attachment: samplesyncfusionschedulewithvue2consoleerror_b4f6debe.zip


AK Ashokkumar Karuppasamy Syncfusion Team May 31, 2024 02:19 PM UTC

Hi Ravi Dudhat,

We would like to clarify that you can remove the built-in styles of the schedule in the e-resource-column table and e-content-table by removing the element in the dataBound event. When resizing these elements, adjust the width accordingly. If the built-in element is removed, the value becomes null, and the width cannot be retrieved, resulting in a console error. To resolve this, we suggest updating the dataBound method with the resize handler event as in the last update. This should resolve the issue. If you encounter any issues with our previously suggested solution, please share the details so we can understand and resolve the problem as soon as possible.

Regards,
Ashok


Loader.
Up arrow icon