Our powerful JS Calendar component


Post by ehc-between »

Hi

I have a mode in my calendar that is implemented from the demo:
https://bryntum.com/products/calendar/examples/calendar-scheduler/

i have also implemented the drag unsceduled events from this demo:
https://www.bryntum.com/products/calendar/examples/frameworks/angular/drag-from-grid/dist/drag-from-grid/

Everything works fine in the normal calendar modes based on this implementation, but it will not work for the scheduler / timeline view.

what do i need to implement for the drag from gid into the timeline / scheduler view ?

Timeline mode Config:

timeline : {
      type: 'scheduler',

  // Used by the Calendar's mode selector button
  displayName: 'Timeline',

  // Used by resourceInfo column to base src for image field:
  // resourceImagePath: '../_shared/images/users/',

  // Change default event style for Scheduler to better match Calendars look
  eventStyle: 'calendar',

  // Calendar does not use initial animations, match that
  useInitialAnimation: false,

  columns: [
    {type: 'resourceInfo', field: 'name', text: 'Staff/Resource', width: 175}
  ],

  features: {
    nonWorkingTime: true,
    timeRanges: true,
    resourceTimeRanges: true,
  },

  workingTime: {
    fromHour: 7,
    toHour: 22
  },

  // Uncomment to change the date range of the time axis
  // range : 'month',

  // Uncomment to change how much the next / previous buttons shift the time axis
  stepUnit : 'day',

  barMargin: 3,
  viewPreset: {
    base: 'hourAndDay',

    headers: [{
      unit: 'day',
      dateFormat: 'ddd MM/DD'
    }, {
      unit: 'hour',
      dateFormat: 'HH:mm'
    }]
  },

  // Custom eventRenderer to match style used by Calendar
  eventRenderer(eventRecord: any, renderData: any) {
    if (eventRecord.isInterDay) {
      return StringHelper.encodeHtml(eventRecord.eventRecord.name);
    }

    return {
      class: 'b-cal-event-body',
      children: [
        {
          class: 'b-event-header',
          children: [
            {
              class: 'b-event-time',
              text: DateHelper.format(eventRecord.startDate, 'LST')
            }
          ]
        }, {
          class: 'b-cal-event-desc',
          text: eventRecord.name
        }
      ]
    };
  }
}
  },

Grid config :

export const gridConfig : Partial<GridConfig> = {
  id          : 'unscheduled',
  title       : 'Unscheduled Events',
  collapsible : true,
  flex        : '0 0 300px',
  ui          : 'calendar-banner',
  features : {
    stripe   : true,
    sort     : 'name',
    cellEdit : false,
    group    : false
  },
  columns : [
    {
      text       : 'Unassigned tasks',
      flex       : 1,
      field      : 'name',
      htmlEncode : false,
      renderer   : ({ record } : { record:EventModel }) =>
        StringHelper.xss`<i class="${record.iconCls}"></i>${record.name}`
    },
    {
      text     : 'Duration',
      width    : 100,
      align    : 'right',
      editor   : false,
      field    : 'duration',
      renderer : ({ record } : { record:EventModel }) =>
        `${record.duration} ${record.durationUnit}`
    }
  ],

  rowHeight : 50
};

Post by alex.l »

Hi,

what do i need to implement for the drag from gid into the timeline / scheduler view ?

Calendar has built-in feature for drag from external source called externalEventSource. But the Scheduler, that you used as one of Calendar's view, doesn't have that feature. So, for that view you'll need to setup DragHelper. We have a demo here https://bryntum.com/products/schedulerpro/examples/drag-from-grid/

All the best,
Alex


Post by ehc-between »

Do you have a example of it done with the scheduler inside the calendar ? how can i use the scheduler inside the mode as a normal scheduler to be able to to configure this ?

// thanks


Post by ehc-between »

Or is it a better way to do this with the grid and calendar alone ? i dont need anything else from the scheduler execpt this view :)


Post by Animal »

Probably best to just let CalendarDrag take care of it in Calendar views.


Post by ehc-between »

Is there any way to configure this or is there a workaround? It would be very much appreciated.


Post by alex.l »

Hi,

I played a bit with integration of DragHelper as I suggested above. Looks like it's not so obvious and easy if we are about to make it working for all views. I guess we should wait when this ticket is fixed https://github.com/bryntum/support/issues/7475

I will ask Animal in working hours about his idea, in case it will work better, we will provide more details how to achieve that.

All the best,
Alex


Post by alex.l »

Hi,

I talked to Animal about the solution. Looks like the way he suggested is also not easy to achieve, so we cannot to provide you solution right away, unfortunately. We have to wait for the ticket.

All the best,
Alex


Post by alex.l »

Hi,

As Animal mentioned in the ticket, this sounds like a big task. I talked to PM, we do not plan to make it in nearest future, I am afraid, so it it will take time to get it done. In case you can't wait, there is an option to sponsor it, contacting Sales here https://bryntum.com/services/ , but I am afraid that's all we can offer you now.

All the best,
Alex


Post Reply