search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Parent resource id (Vue Scheduler)

Asked by Hardik
1 year ago.

want to get parent resource id on event move ,
is there is any way to achieve that ?
Used this
var parentId = dp.rows.find("A").parent().id;
but not get anything and also don't have idea what use in vue js for dp ?

Answer posted by Dan Letecky [DayPilot]
1 year ago.

The "dp" variable used in example is a reference to DayPilot.Scheduler object.

In Vue, you can get it using the "ref" attribute:
<template>
  <DayPilotScheduler id="dp" :config="config" ref="scheduler"/>
</template>

<script>
import {DayPilot, DayPilotScheduler} from 'daypilot-pro-vue'
import {onMounted, reactive, ref} from 'vue';

export default {
  components: {
    DayPilotScheduler
  },
  setup() {
    const scheduler = ref(null);
    const config = reactive({
      timeHeaders: [{groupBy: "Month"}, {groupBy: "Day", format: "d"}],
      scale: "Day",
      days: DayPilot.Date.today().daysInMonth(),
      startDate: DayPilot.Date.today().firstDayOfMonth(),
      // ...
    });

    onMounted(() => {
      scheduler.value.control.message("Welcome!");
    });

    return {
      scheduler,
      config
    };
  },
};
</script>

To call the rows.find() method, use the "scheduler" constant:

const parentId = scheduler.value.control.rows.find("A").parent().id;

See also:
https://doc.daypilot.org/scheduler/vue-js/

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.