Show cool things you have done with our products


Post by junaid »

I am trying to alter the externaldragdrop example to get the tasks to have fixed start and end times, as opposed to a fixed duration and variable starttime that is dependant on the drop position. The idea being that tasks must be worked at their required start and end times and only people with time to do them will allow the drop.

I see that the object returned from the Ext.dd.DragZone.getDragData function specifies the "duration" property, my reasoning is that setting the property for a start time in this return object would be the solution. Not sure if this assumption is correct or how I can achieve the behaviour I want.

Thanks

Post by mats »

I just created a tweaked version of that example: http://ext-scheduler.com/playpen/ex ... gdrop.html

The example adds a StartDate field for each task (you could of course change this to whatever you want) and uses that date as the start date when the task is dropped. Does this solve your problem?

Post by junaid »

thanks Mats, yes that is what I am looking for. Incidently i did the same thing but did struggle with the getDragData return object of Ext.dd.DragZone. I believe that this object is external to your control and that the DragData would be specific to the application that uses this DragZone, in this case your scheduler control. I did not know where to find the object details that your control requires, specifically what the start date and end date parameter names where. I guess that it would be the structure of your eventStore as stated in your code, where would one find all the parameters ? for example the parameter "duration" can also be used when returning the DragData object.
// Store holding all the tasks
var eventStore = new Ext.data.JsonStore({
sortInfo:{field: 'ResourceId', direction: "ASC"},
idProperty : 'Id',
fields : [
{name: 'Id', type:'string'},
{name: 'ResourceId'},
{name: 'StartDate', type : 'date'},
{name: 'EndDate', type : 'date'},
{name: 'Title'}
]
})
One additional thing, I need for the events to stay with those start and end times and only assignment to the resource should change, I notice that after the event is on the scheduler view it's start can then be changed. I would assume that I would need to trap a "before change" event and record the start and then trap the "after change" event to set it back. Would the scheduler panel events be the right way to acomplish this ?

Post by mats »

Regarding the dnd, the internal scheduler drag drop implementation requires the Duration parameter to be set. What we are doing is basically to override the built in dnd mechanism of the scheduler. I add start and end date to be able to apply them after the dropbox is made.

To restrict drag dropbox after an event has been placed in the scheduler, just set the enableEventDragDrop to false. Check the API docs for more details about config options.

Let me know how it goes ;)

Post Reply