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

How to get all events by Resource

Asked by Ben
4 years ago.


How can a find a delete all events by a Resource. I found this response from 5 years ago, but I cannot find any reference for findRowByResourceId in the Documentation.

Answer posted by Dan Letecky [DayPilot]
5 years ago.
On the client-side, you can do the following:

var hasEvents = dps.findRowByResourceId("A").events.length > 0;
On the server side, there is no internal structure that keeps events matched to the resources. You would have to go through the data source (you can reuse what you assign to DataSource property, so you don't have to load everything from the database twice).

See also the following tutorial that filters resources depending on the associated events. It works the other way - i.e. it shows only the free rows but you should be able to adjust the SELECT command as needed:

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


You can get a list of all events like this:

var events = dp.rows.find("A").events.all();

And delete them:

dp.rows.find("A").events.all().forEach(function(e) {; 

See also:

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