Prevent Column Template from Redrawing on Task Update

Is it possible to set the column template function to only be called when a task is added? I want to incorporate a select list into my column template and have the options populate dynamically out of a JSON request. I’m able to set that up just fine by setting my template to

template: function(obj){ return ‘<select id=T’ + + ‘>’}

And then using jQuery to select by ID and then append my tags accordingly in an ‘onAfterTaskAdd’ event. That’s grand, and does exactly what I want.

However, any time the task is updated (via a drag or other edit) the template redraws and leaves me with an empty select again. I’d like to have the template drawn once and only once.

Edit: I just noticed that the templates redraw any time a new task is added as well.

Is there a way to do this?

Many thanks,



Please, check the demo:

You can add any property to task data and use different templates according it.

there is no way to suppress refreshing the markup inside the gantt, this is due design.

If you need complex JS editors in a disposable markup, try creating and displaying the editors only when they are needed - i.e. create select box only when user clicks on an editable column and destroy it after the editing is done.

In order to do so, you can capture onTaskClick event, which receives a DOM event as a second argument - you can detect which column is clicked and initialize editor inside the cell … event.html