Creating custom editors in DHTMLX Scheduler

Hi,

I am using DHTMLX Scheduler in an application that requires a custom section with a template type editor. The editor need to have a search text box, a button and a drop down list. How do I instantiate these controls in the event handler? An example with a custom editor section would be greatly helpful.

scheduler.locale.labels.section_greeting = ‘Template’;// sets the section label that will be displayed in the header of the section

scheduler.config.lightbox.sections=[
// other sections
{ name: “greeting”, height: 21, map_to: “my_template”, type: “template” }
];

scheduler.attachEvent(“onEventCreated”, function(id, native_event) {
var ev = scheduler.getEvent(id);
ev.my_template = “Hello there! And there too!”; // my_template is the value of the ‘map_to’ property
});
Source: docs.dhtmlx.com/doku.php?id=dhtm … r:template

Hi,

check this article, there is an example below
docs.dhtmlx.com/doku.php?id=dhtm … om_editors

Btw, please check scheduler/samples/02_customization/15_combo_select.html example, maybe this control is what you need?

Thank you Aliaksandr for your quick response.

I have added sample light box image (updated in paint) of what has been accomplished so far and what needs to be accomplished and also database relationship we are trying to link light box to:

Image: A

  • Database relationship

Image: B

  • Accomplished so far

Image: C

  • Need to Accomplish

The customer id field is a foreign key in the Schedule_visit table. We need to be able to search customer and once searched customer is selected, the text box (grey one, left top of light box) should display searched customer name and its value should be bound to customer_id (see image:C in attached image).

Thanks,


Hello,
you can use scheduler.formSection(controlName).node to access control’s html once it is rendered. Then you’ll be able to attach custom event handlers to trigger search

Thanks, I will give it a try…

Thanks Aliaksandr, I managed to create custom editors and bind them to custom javascript events as well.

Right now I am facing one other issue, i.e. I want to insert ‘null’ values in database for customer_id foreign key, if I leave customer field blank (see reference image from previous post). How do I achieve that. currently SchedulerConnector is being used to perform insert and update.

on server side

[code]function update_null_values($action){
if ($action->get_value(“customer_id”) == “”)
$action->set_value(“customer_id”, Null);
});

$scheduler->attachEvent(“beforeProcessing”, update_null_values);[/code]

Thanks Stanislav.

I managed to customize insert and update using Java code examples from following sites which I found very helpful:

code.google.com/p/dhtmlxconnecto … r.java?r=2

code.google.com/p/dhtmlxconnecto … r.java?r=2

And also:
docs.dhtmlx.com/doku.php?id=dhtm … foreupdate

Thanks DHTMLX Support team