Loading data from MSSQL using dhtmlxscheduler

Why am i not getting the values populated in the dropdown boxes?

incorrect

options:[scheduler.serverList("NAME")]},

correct

options:scheduler.serverList("NAME")},

i did not find a function where onselectdate()
There is onBeforeLightBox event , but it will not be easy, locating and hiding the section may be tricky. You may consider usage of custom form ( fully replace lightbox with a custom form )

hat methods do i have to get the values from the combo boxes

You need to set unique values for

map_to:"NAME",

so selection result will be saved to related properties of event

the sceduler generates a eventid is this unique?
Client side IDs are unique per session, and in most cases are true unique. But if you have few users which creates events in the same time, there is a small chance that their id will be the same.

Thanks Stanislav
what I mean by >>hat methods do i have to get the values from the combo boxes is I know they are mapped to name but what are
those get methods used for combo boxes to retrieve the selected value
please let me know asap
TIA

Hi stanislav,
I have another question you said its a bit tricky and suggested to use a custom form for the lightbox
what is the behavior of this code
scheduler.showLightbox = function(id){
document.getElementById(“my_editor”).style.display=“block”;
}

scheduler.form_blocks[“my_editor”]={
render:function(sns){
return “

Text 
Details 
“;
},
set_value:function(node,value,ev){
node.childNodes[1].value=value||””;
node.childNodes[4].value=ev.details||"";
},
get_value:function(node,ev){
ev.location = node.childNodes[4].value;
return node.childNodes[1].value;
},
focus:function(node){
var a=node.childNodes[4]; a.select(); a.focus();
}
}

scheduler.config.lightbox.sections=[
{ name:“description”, height:200, map_to:“text”, type:“my_editor” , focus:true},
{ name:“time”, height:72, type:“time”, map_to:“auto”}
]

what does this code do?
scheduler.showLightbox = function(id) and we are having problems with the code it does save or it doesnt update events it just hangs any clues?

is it possible to add a custom function on lightbox.js ?Do all methods have to start with scheduler.xxx_lightbox=function() ? is this a template ? I am looking to add a custom function for the select dropdown box of date like month and year and date
so in my lightbox.js can i add a function to take some action when the user selects the date
in the sense can onChange events like below be called to take some action like the way its trying to call ‘scheduler.select_lightbox’ method I am trying to see if theere is function already built in to for onChange events of dropdown boxes please let me know

var html="";
for (var i=first; i<last; i+=this.config.time_step*1){
var time=this.templates.time_picker(dt);
html+=""+time+"";
dt=this.date.add(dt,this.config.time_step,“minute”);
}

//days
html+=" “;
for (var i=1; i < 32; i++)
html+=”"+i+"";
//month
html+=" ";

Hello Stanislav,
Here is my custom form sample code
scheduler.form_blocks[“my_editor”]={
render:function(sns){

var cfg = scheduler.config;
var dt = this.date.date_part(new Date());
var last = 2460, first = 0;
if(scheduler.config.limit_time_select){
last = 60
cfg.last_hour+1;
first = 60*cfg.first_hour;
dt.setHours(cfg.first_hour);
}

var html="";
for (var i=1; i < 32; i++)
html+=""+i+"";

//month
html+=" “;
for (var i=0; i < 12; i++)
html+=”"+this.locale.date.month_full[i]+"";

//year
html+=" “;
dt = dt.getFullYear()-5; //maybe take from config?
for (var i=0; i < 10; i++)
html+=”"+(dt+i)+"";
html+=" ";

for (var j=1; j < 32; j++)
html+=""+j+"";

								//month

html+=" “;
for (var k=0; k < 12; k++)
html+=”"+this.locale.date.month_full[k]+"";

//year
html+=" “;
dt=this.date.date_part(new Date());
dt = dt.getFullYear()-5; //maybe take from config?
for (var m=0; m < 10; m++)
html+=”"+(dt+m)+"";
html+="";
return "


Monday 123
Tuesday 123
“+html+”
";
},
set_value:function(node,value,ev){
//node.childNodes[1].value=value||"";
//node.childNodes[4].value=ev.details||"";
},
get_value:function(node,ev){
//var selectval=my_custom_form.myhome.options[document.my_custom_form.myhome.selectedIndex].value;
var selectval=node.getElementsByTagName(“select”)
alert(selectval[0].value);
alert(selectval[1].value);
alert(selectval[2].value);
scheduler.setLightboxSize();
return “”;/node.childNodes[1].value;/
},
focus:function(node){

}
}

scheduler.config.lightbox.sections=[
{ name:“description”, height:200, map_to:“text”, type:“my_editor” , focus:true}
]

}

Can you tell me how i can hide the select box using onChange event described above.The onChange event triggers the JavaScript:call() function ?

using the below code
set_value:function(node,value,ev){
//node.childNodes[1].value=value||"";
//node.childNodes[4].value=ev.details||"";
},

how do i set values to the select dropdown box when i retrieve the values from the DB? From the arguments node,value,ev ?Can we get a event id from the ev? please let me know

in the get functionality
get_value:function(node,ev){
//var selectval=my_custom_form.myhome.options[document.my_custom_form.myhome.selectedIndex].value;
var selectval=node.getElementsByTagName(“select”)
alert(selectval[0].value);
alert(selectval[1].value);
alert(selectval[2].value);
scheduler.setLightboxSize();
return “”;
},

how do i retrieve the values from the select elements ? The above code is just sample code .Is there a better way to code in order to get the values.

Also i am using the same code for time like date month and year . I dont think there should be any problem but just want to get your opinion.Please let me know

thanks

Hello Stanislav,
In addition to the above questions i have a problem with IE display the event as truncated i have enclosed the screen shot. Can we increase the height of the yellow bar so we see it more clearly? Please let me know
Looking forward to your reply for all the questions above
Thanks


If you are want to redefine lightbox form you need only to use

scheduler.showLightbox = function(id){ document.getElementById("my_editor").style.display="block"; }

Where #my_editor is container with your custom form.

the event as truncated
Caused by css conflict.
If issue still occurs for you - please provide any kind of sample or demo link where it can be reconstructed.

Can you tell me how i can hide the select box using onChange event

You can access html container of form section as

document.getElementById(scheduler.config.lightbox.sections[index].id );

and use DOM methods to hide it

how do i set values to the select dropdown box when i retrieve the values from the DB?
normally ev object already contains values from DB, so you can just set them equal to some properties of ev object.

how do i retrieve the values from the select elements ?
You need to store them in ev object, later they will be sent to server side as part of event saving process.

The event bar is truncated …this happens in IE7 and looks good in google chrome. I remember you saying in IE its full loaded not sure what you meant by that .Any suggestiongs this is just html code opened in IE7 browser ?

Also with respect to get set_value:function(node,value,ev){
can i get ev.getID() //i need event id here how do i get it?
how do i set values in the event object which are captured from select boxes? what api methods do we have here ?
}
get_value:function(node,ev){
how do i set values back to the select boxes here using the event object ? what api methods do i have here ?
}

Please let me know

hello stanislav,
when i drag on the scheduler and tried to create a new event the light box shows up with enddate and start date 30st aug and 28th aug.How ever behind the light box the event bar shows only for 28th and 29th .is that normal? when i click on save it updates for all 3 dates 28th ,29th and 30th .Please let me know
Thanks

Looking for a response for all teh above questions
TIA

.How ever behind the light box the event bar shows only for 28th and 29th
Normally such situation must not occur.
In any case, the end date in lightbox must be equal to position, where mouse was released

The event bar is truncated …this happens in IE7 and looks good in google chrome.
If issue still occurs for you - please provide any kind of sample or demo link where it can be reconstructed.

can i get ev.getID() //i need event id here how do i get it?
just use ev.id

how do i set values in the event object which are captured from select boxe
It is raw hash of data, no API, direct setters

… //set_value , from event to the form
select.value = ev.some_property;
… //get_value , from form to the event
ev.some_property = select.value;

Thanks Stanislav,
Here is the screenshot .This is from your samples file samples\01_initialization_loading\06_multi_day_events.html

I have dragged the mouse on 14th and 15 and i see the event bar there.But in the lightbox it shows the enddate is 16th where as it should be 15th.

Please let me know


Is it default sample or it has some modifications ? Is it IE in quirks mode ?
The form looks corrupted, which is not occurs locally.

Yes it is from the sample and no modifcations.How do you say the form is corrupted?

hello Stanislav,
My custom form looks like this
scheduler.form_blocks[“my_editor”]={
render:function(sns){
return "

Monday 
sea zero
sea one
sea two
sea three
sea four


Tuesday 
sea zero
sea one
sea two
sea three
sea four
"; }, set_value:function(node,value,ev){ // I retrieve the values from DB for Monday the values are 2 and Tuesday the values are 1 and now i want to set the value in the select boxes and when the lightbox shows up it should show monday with one option lets say "sea two" as selected and similary tuesday with sea zero as option selected. var s =node.getElementsByTagName("select"); s[0].value =2; s[1].value=1 //Setting the values this way here doesnt work and lightbox loads but the option is not selected. what is the correct syntax to set values to the select box if the above 2 are my select boxes so the user can see this option selected in teh lightbox please help }, }

Yes it is from the sample and no modifcations.How do you say the form is corrupted?
The selectboxes in the form goes to second line
You have some custom css files on the page, which changes their layout, or you are using IE in Quirks mode, which is not supported.

Setting the values this way here doesnt work and lightbox loads but the option is not selected.
Code which you are using is correct and must set values of selectboxes correctly.
Can you provide any kind of sample or demo link where problem can be reconstructed?

Yes i am using IE 7 and the first line of DOCTYPE

I think in IE 6 and 7 this will enforce quirks mode .But if i remove this the event names get truncated like the screenshots which i sent earlier in this thread but if i have it it shows completly.
Please advise.

Also
I want to pass a string when the calendar first loads and according to your example in events.php passing a a userid to connector

<?php //connector 1.x include ('../../../codebase/connector/scheduler_connector.php'); include ('../../common/config.php'); $res=mysql_connect($server, $user, $pass); mysql_select_db($db_name); $user_id = intval($_GET['user']); $scheduler = new schedulerConnector($res); $scheduler->enable_log("log.txt",true); function default_values($action){ global $user_id; $event_type = $action->get_value("event_type"); if ($event_type == "") $event_type = 0; $action->set_value("userId",$user_id); } $scheduler->event->attach("beforeProcessing","default_values"); $scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId"); ?>

How do we translate this code equivalent in java .I am not a PHP programmer so please help

and i am not using custom css .here is the code

html, body{ margin:0px; padding:0px; height:100%; overflow:hidden; }
 
 

Yes i am using IE 7 and the first line of DOCTYPE

I think in IE 6 and 7 this will enforce quirks mode .But if i remove this the event names get truncated like the screenshots which i sent earlier in this thread but if i have it it shows completly.
Please advise.

Also
I want to pass a string when the calendar first loads and according to your example in events.php passing a a userid to connector

<?php //connector 1.x include ('../../../codebase/connector/scheduler_connector.php'); include ('../../common/config.php'); $res=mysql_connect($server, $user, $pass); mysql_select_db($db_name); $user_id = intval($_GET['user']); $scheduler = new schedulerConnector($res); $scheduler->enable_log("log.txt",true); function default_values($action){ global $user_id; $event_type = $action->get_value("event_type"); if ($event_type == "") $event_type = 0; $action->set_value("userId",$user_id); } $scheduler->event->attach("beforeProcessing","default_values"); $scheduler->render_sql("select * from events_shared where userId = ".$user_id,"event_id","start_date,end_date,text,event_type,userId"); ?>

How do we translate this code equivalent in java .I am not a PHP programmer so please help
i want to pass a userid and a String x=12 ? is that possible? Please let me know with code as well
Thanks