Visualize Name instead of Id

Hi everybody, sorry for my English. In htmlscheduler I would like to view the Name of a Patient in the text of an event instead of his Id.

This is my configuration script:

Thanks for all suggest…



Nobody can help me? :cry:

Hello,

Please note that posting in relevant section of forum helps a lot :slight_smile:
Provide content of your db_pazienti.php script.

Kind regards,
Ilya

You can try to use

scheduler.templates.event_text = function(s,e,ev){ return scheduler.getLabel("x_pazienti_id", ev.x_pazienti_id); };

Ok, it works. Thank you. :wink:

Now when I close the Calendar and I reopen, or when I refresh, the name disappear, I would like to view the label when I reopen the calendar.

P.S. Sorry for the post in this section, I’ll post the question in the right section too.


I forgot the db_pazienti.php script, it’s this:

<?php include ('../dhtmlxScheduler/codebase/connector/scheduler_connector.php'); include ('../dhtmlxScheduler/common/config.php'); $res=mysql_connect($server, $user, $pass); mysql_select_db($db_name); $list = new OptionsConnector($res); $list->render_table("x_pazienti","IdPaziente","IdPaziente(value),Paziente(label)"); $scheduler = new schedulerConnector($res); $scheduler->enable_log("log.txt",true); $scheduler->set_options("x_pazienti", $list); $scheduler->render_table("events","event_id","start_date,end_date,x_pazienti_id"); ?>

The scheduler’s connector expects to have the text of events as third parameter, and using foreign-key instead of it doesn’t work very well. You can try to chagne code in connector file as

$scheduler->render_table("events","event_id","start_date,end_date,event_text,x_pazienti_id"); 

if you have not any event related text field, you can use code like

function removeFake($action){ $action->remove_field("event_id"); } $scheduler->event->attach("beforeProcessing", "removeFake"); $scheduler->render_table("events","event_id","start_date,end_date,event_id,x_pazienti_id");

I changed my connector with:

$scheduler->set_options(“x_pazienti”, $list);
$scheduler->render_table(“events”,“event_id”,“start_date,end_date, event_name, x_pazienti_id”);

Now it’s ok.

I can’t understand why it works, now I can always see the name of patient. I dindn’t use event text !!!

SchedulerConnector has predefined meaning for first, second and third parameters, they must be

  • start data
  • end date
  • event’s text

You can’t place property with custom name in those positions