Display load data from SQL statements


i still new with dhtmlxScheduler. what i am trying to do is to list data from 2 table which is from table user and position.with this list i would like to implement it with checkbox which will show user name and their position.

this is my code for server side

$list = new OptionsConnector($res);
$list->render_table("user, position WHERE position.id = user.position_id AND flag_retire=0","user.id","user.id(value),user.name(label)");

$scheduler->set_options("frminvite", $list);

client side

var cols=4;
var bilangan=0;
var modcol=cols-1;	

var html="<div class=dhx_cal_mycheckbox>";						
html+="<table border=0 cellpadding=1 cellspacing=0 width=100% style=color:black;>"+
"<tr bgcolor=black style=color:white;><td width=10><b>No.<b></td>"+
"<td align=center><b>Name</b></td><td align=center><b>Position</b></td>"+

for (var i=0; i < sns.options.length; i++){

html+="<tr><td align=center>"+ bilangan +".</td><td>"+sns.options[i].label+
"</td><td>--</td><td>Invite <input type=checkbox value="+sns.options[i].key+"></td></tr>";
if (i%cols == modcol) html+="</tr><tr>";
return html;


{name:"invition", height:21, map_to:"user_id", type:"my_checkbox",options:scheduler.serverList("frminvite")}

i only get know to use (value) and (label) using set_options, which can only use to display 2 data from SQL,but i would like to use like this

$list->render_table("user, position WHERE position.id = user.position_id AND flag_retire=0","user.id","user.id,user.name,position.name");

which will get 3 field from the 2 table, but i did not know how to display all the 3 field in the client side.


You can’t select 3 fields, but you can construct the necessary string directly in SQL as

$list->render_sql("SELECT user.id, user.id as value, CONCAT ( user.name, ' ', position.name ) as value WHERE position.id = user.position_id AND flag_retire=0","user.id","user.id(value),user.name(label)");

or you can use render_table as in your original code, but attach beforeRender event handler, and format code of “label”, from DB fields in any custom way.

Thanks it works…