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

How to put my Ressource from my Database to the scheduler ressource ?

Asked by Loïc
7 years ago.

Hi Guys,

I was looking to take my ressource data from the database to integrate them into my scheduler ressource but i don't find the way to do it.

Does someone has already done it ? and can give me a little help ?

Answer posted by Dan Letecky [DayPilot]
7 years ago.

In Java, you can load the resources on the server side using getResources() method. Just fill the collection as needed. An example from https://java.daypilot.org/scheduler-tutorial/:

public class Dps extends DayPilotScheduler {

  @Override
  public void onInit() throws Exception {

    // map the database column names
    setDataResourceField("event_resource");
    setDataIdField("event_id");
    setDataTextField("event_name");
    setDataStartField("event_start");
    setDataEndField("event_end");

    // assign the collection of events
    setEvents(Db.getEvents(getRequest(), getStartDate().toDate(), getStartDate().addDays(getDays()).toDate() ));

    // set the resources
    getResources().clear();
    getResources().add("Room A", "A");
    getResources().add("Room B", "B");
    getResources().add("Room C", "C");

    // request a full update of the control on the client side
    update(UpdateType.FULL);
  }
}

This example adds the resources manually but you can also do it using data received from the database.

Comment posted by Loïc
7 years ago.

I Found the way to do It, i was blocked because of the treemap (first time i used that).
Thanks for your help :)

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