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

Move Resoources

Asked by Stratus
10 months ago.

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

Answer posted by Dan Letecky [DayPilot]
10 months 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
10 months 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]
10 months ago.

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

Answer posted by Stratus
9 months ago.

oki ty !

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