Lightbox Custom Combo

So far everything has been great but I can’t figure this one out. It’s probably something stupid on my part. I created a combo in place of the default text area. It does not fire the php on load to fill the combo box. Once lightbox is up if I type it auto fills the names from the MySQL DB but how do you get it to load all the items at start up?

scheduler.locale.labels.section_holder = “customers”;

scheduler.config.lightbox.sections = [
{name:“Customers”,options:“customers”, map_to:“customers”, type:“combo”,script_path:“customers.php”,option:“customers”,
image_path:“dhtmlxcombo/codebase/imgs/dhxcombo_material/”, height:30, filtering:true},
{name:“recurring”, height:115, type:“recurring”, map_to:“rec_type”,
button:“recurring”},
{ name:“time”, height:72, type:“time”, map_to:“auto”}
];

<?php require_once('../connectors/db_mysqli.php'); require_once('../connectors/combo_connector.php'); require_once('dhtmlxcombo/config.php'); $res=mysqli_connect("74.93.168.49:3306","jfribo","rjahujjt","master"); if (!$res) { echo "Error: Unable to connect to MySQL." . PHP_EOL; echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL; echo "Debugging error: " . mysqli_connect_error() . PHP_EOL; exit; } $combo = new ComboConnector($res, "MySQLi"); $combo->event->attach("beforeFilter", "by_id"); function by_id($filter) { if (isset($_GET['ID'])) $filter->add("ID", $_GET['ID'], '='); } $combo->dynamic_loading(false); $combo->render_table("Customers","ID","L_Name"); return $combo; ?>

Hi,
I think the error is here:

function by_id($filter) { if (isset($_GET['ID'])) $filter->add("ID", $_GET['ID'], '='); }
you need “id” instead of “ID”, the combo seems to always use lower case “id” for request parameter:
github.com/DHTMLX/scheduler/blo … ors.js#L73

Everything should work if you replace that part as following:

function by_id($filter) { if (isset($_GET['id'])) $filter->add("ID", $_GET['id'], '='); }

Thank you for the reply. I tried it just to see and it still isn’t filled. I think the real problem is for some reason it never calls the customer.php to start with which would be needed to load the combo with the records but it never gets called until I start to type something and then it autofills with say the names that start with whatever letter I typed. What do I need to do so the combo gets filled from the start? Do I need to do an $.get call or something? My instinct says that it should load without having to make a separate call.

Since I guess this hasn’t happened to anyone before can someone at least tell me, should the php script be called when the main page or lightbox is called up? Or do I need to call the php script via another call first? Thanks.

Update: Changed to the below code, still no dice. It does not have the list even though I called the php and it ran successfully. Any ideas, anyone, Bueller, Bueller?

$.get(“http://74.93.168.49:8383/customers.php”,function (data) {
scheduler.updateCollection(“comboOptions”,data);
});

scheduler.locale.labels.section_holder = “customers”;

scheduler.config.lightbox.sections = [
{name:“Customers”, map_to:“Customers”, type:“combo”,options:scheduler.serverList(“comboOptions”),
image_path:“dhtmlxcombo/codebase/imgs/dhxcombo_material/”, height:30, filtering:true},
{name:“recurring”, height:115, type:“recurring”, map_to:“rec_type”,
button:“recurring”},
{ name:“time”, height:72, type:“time”, map_to:“auto”}
];

Hi,
sorry for a delay. Could you please attach a complete example (html page, php script, sql dump of test db tables and required js/css/php codebase) so I could try reproducing the issue?
Usually there shouldn’t be a problem with loading the initial option, since when you open the lightbox combo send a requrest to the script path providing a selected id as GET parameter (i.e. in your case the request url could look as “customers.php?id=3”), the server response should contain only a single item which will be displayed as a selected option in combo. If it for some reason doesn’t happen in your app we’ll need a demo to find out whats wrong