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

Move Resoources

Asked by Stratus
6 years ago.

hello is it possible to move resources with javascript besides the drag n drop for one resource ?

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

You can also move a resource by modifying the "resources" array. Afer making the changes, call update() to refresh the Scheduler.

This example sorts the rows alphabetically (by name):

var dp = new DayPilot.Scheduler("dp");
dp.resources = [ /* ... */ ];
// ...
dp.init();

function sortResourcesAlphabetically() {
  dp.resources.sort(function(a, b) {
    var resA = a.name.toLowerCase();
    var resB = b.name.toLowerCase();
    if (resA < resB) {
      return -1;
    }
    if (resA > resB) {
      return 1;
    }
    return 0;
  });
  dp.update();
}
Comment posted by Stratus
6 years ago.

hi this is nice to reorder all of them , but i wanna be able to drag an drop for example 5 resources on the top of the list as we do with one , is that possible ?

Comment posted by Dan Letecky [DayPilot]
6 years ago.

Yes, just modify dp.resources as needed and call update().

Answer posted by Stratus
6 years ago.

oki ty !

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