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

Manipulate the text in the in-place editor

Asked by Anonymous
3 years ago.

Hi,
I would like to run some checks and then manipulate (format or convert) the text entered using the in-place editor. I thought I could do in the events onEventEdit or onEventEdited by changing args.newText, however this doesn't work at all.
Thanks

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

The args.newText value is read-only and you can change the text by canceling the default event and submitting the adjusted value:

dp.onEventEdit = function(args) {
  args.preventDefault();
  args.e.data.text = args.newText + " modified";
  dp.events.update(args.e);
};

Since version 2020.4.4730 the args.newText can be modified directly:

dp.onEventEdit = function(args) {
  args.newText = args.newText + " modified";
};

Please note that both approaches only work in onEventEdit. The onEventEdited method is fired after the default action.

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