0

I'm using Dhtmlx scheduler and it works really fine, but I have some issue with customization of the LightBox. I have added a dropdown list and I would like to load data from my MySqli db using json. Here is my code

require_once('codebase/connector/scheduler_connector.php');
require("codebase/connector/db_mysqli.php");    

$mysqli = new mysqli("$db", "$dbn", "$pw",  "$tb"); 


$listcollab = new OptionsConnector($mysqli, "MySQLi");
$listcollab->render_table("Operator","ID","ID(value),Name(label)");


$scheduler = new JSONSchedulerConnector($mysqli, "MySQLi");
$scheduler->set_options("coll", $listcollab); //without this scheduler charge data

$scheduler->render_table("Agenda","ID","AppStart,AppEnd,Cliente,Servizio");

This is Client side

var list = scheduler.serverList("coll");    

    function init() {
        scheduler.config.xml_date = "%Y-%m-%d %H:%i";
        scheduler.config.prevent_cache = true;
        scheduler.config.first_hour = 8;
        scheduler.config.last_hour = 21;
        scheduler.config.limit_time_select = true;
        scheduler.locale.labels.section_location = "Servizio";
        scheduler.locale.labels.section_select = 'Seleziona';
        scheduler.config.details_on_create = true;
        scheduler.config.details_on_dblclick = true;
        scheduler.config.prevent_cache = true;

        scheduler.config.lightbox.sections = [
            {name:"CLIENTE", height:90, map_to:"Cliente", type:"textarea" , focus:true},
            {name:"Servizio", height:43, type:"textarea", map_to:"Servizio" },
            {name:"select", height:40, map_to:"ID", type:"select", options:scheduler.serverList(list)},
            {name:"Collaboratore", height:43, type:"textarea", map_to:"auto" },
            {name:"Orario", height:72, type:"time", map_to:"auto"}
        ];

        scheduler.init('scheduler_here', new Date(2015, 9, 23), "week");
        scheduler.load("connessione.php", 'json');

        var dp = new dataProcessor("connessione.php");
        dp.init(scheduler);

Can someone helps me to get data from db using php? Thanks in advance

Jayelef
  • 135
  • 12

1 Answers1

1

What you use on server side? If you have PHP and dhtmlxConnector on a backend, this article should help.

If you've implemented data loading manually then you'll need these two methods: http://docs.dhtmlx.com/scheduler/api__scheduler_serverlist.html http://docs.dhtmlx.com/scheduler/api__scheduler_updatecollection.html

The common way to go is following - you declare options as named collection using scheduler.serverList method, and then update using scheduler.updateCollection when data is loaded from the server

Alex Klimenkov
  • 956
  • 1
  • 5
  • 8
  • Thank you, I sow the first article, but not the other links. I will try this new suggest. – Jayelef Oct 26 '15 at 10:32
  • I have edited my post so you can correct it. It doesn't works properly. If I use set_options on the server-side, nothing appears and scheduled data desappaired also. Have you a suggest? Thanks – Jayelef Oct 26 '15 at 12:14
  • Note that you provide an array as first argument of serverList method var list = scheduler.serverList("coll"); and then: {name:"select", height:40, map_to:"ID", type:"select", options:scheduler.serverList(list)}, If you change it to following, everything should work: {name:"select", height:40, map_to:"ID", type:"select", options:scheduler.serverList("coll")}, – Alex Klimenkov Oct 26 '15 at 14:01
  • Thanks! IT WORKS PROPERLY! – Jayelef Oct 26 '15 at 14:12