Hello,
I am using open connector for fetching the resource name in y axis of timeline through stored procedure , but is not coming.
I am using below code for connector
[code]package com;
import java.sql.Connection;
import java.sql.DriverManager;
import org.apache.catalina.connector.Request;
import com.dhtmlx.connector.ConnectorBehavior;
import com.dhtmlx.connector.ConnectorServlet;
import com.dhtmlx.connector.DBType;
import com.dhtmlx.connector.DataItem;
import com.dhtmlx.connector.JSONSchedulerConnector;
import com.dhtmlx.connector.OptionsConnector;
import com.dhtmlx.connector.SchedulerConnector;
public class Myconnector extends ConnectorServlet{
@Override
protected void configure() {
//obtain DB connection
try {
Connection conn=null;
// Class.forName ("org.postgresql.Driver").newInstance ();
Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance ();
conn = DriverManager.getConnection("jdbc:sqlserver://SPC102:1433;user=sa;password=crmit@123;database=EMM_Portal_Test");
//Initialize connector
SchedulerConnector c = new SchedulerConnector(conn, DBType.MSSQL);
OptionsConnector oc= new OptionsConnector(conn, DBType.MSSQL);
oc.render_complex_sql("exec usp_Schedule_FetchAll_Test 123456,1,1,'Week','19 JUL 2016','15,16','NormalShiftCrossTab','rank',0", "value", "value,label");
c.set_options("sections", oc);
c.render_complex_sql("exec usp_Schedule_FetchAll_Test 123456,1,1,'Week','19 JUL 2016','15,16','ScheduleList','rank',0", "scheduleId", "MarkingDateStart,MarkingDateEnd,PreferredMarkingQueueShortName,MarkerName");
}
catch (Throwable e) {
e.printStackTrace();
}
}
}
[/code]
my jsp page is like below
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<%-- <script type="text/javascript" charset="utf-8" src='<s:url value="./js/dhtmlxscheduler.js"/>'></script> --%>
<script type="text/javascript" charset="utf-8" src="./codebase/dhtmlxscheduler.js"></script>
<link rel="stylesheet" href="./codebase/dhtmlxscheduler.css" type="text/css" media="screen" title="no title" charset="utf-8">
<script src="./codebase/ext/dhtmlxscheduler_limit.js" type="text/javascript" charset="utf-8"></script>
<%-- <script src="./codebase/ext/dhtmlxscheduler_dhx_terrace.js" type="text/javascript" charset="utf-8"></script> --%>
<script src="./codebase/ext/dhtmlxscheduler_minical.js" type="text/javascript" charset="utf-8"></script>
<script src="./codebase/ext/dhtmlxscheduler_timeline.js" type="text/javascript" charset="utf-8"></script>
<!-- for ajax call for sections -->
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<style media="screen">
html, body{
margin:0px;
padding:0px;
height:100%;
overflow:hidden;
}
.dhx_cal_event {
z-index: 1;
cursor: pointer;
}
.highlighted_timespan {
opacity:0.5;
filter:alpha(opacity=50);
cursor: pointer;
z-index: 0;
}
</style>
<script charset="utf-8">
function init() {
scheduler.config.xml_date="%Y-%m-%d %H:%i";
scheduler.createTimelineView({
name: "timeline",
x_unit: "minute",
x_date: "%H:%i",
x_step: 30,
x_size: 12,
x_start: 16,
x_length: 48,
y_unit:scheduler.serverList("sections"),
y_property: "value",
render:"bar"
});
scheduler.init("scheduler_here",new Date(2016,07,18),"timeline");
scheduler.load("myconnector.do?uid="+scheduler.uid());
var dp = new dataProcessor("myconnector.do");
dp.init(scheduler);
}
function setScaleHeight(){
if (dayScale != 0){
scheduler.xy.scale_height;
} else {
scheduler.xy.scale_height = scheduler.xy.scale_height*2;
}
dayScale = 1;
}
var func = function(e) {
//alert("hrello");
e = e || window.event;
var el = e.target || e.srcElement;
var value = el.value;
updateTimeline(value);
};
function loadOptions(){
scheduler.load("myconnector.do?uid="+scheduler.uid());
}
var dayScale;
function updateTimeline(value){
//alert('hello');
var timeline = scheduler.matrix.timeline;
switch (value) {
case "1":
timeline.x_unit = "minute";
timeline.x_date = "%H:%i";
// timeline.x_date = "%h:%i:%s";
scheduler.templates.timeline_scale_date = function(date){
var func=scheduler.date.date_to_str(timeline.x_date);
return func(date);
};
timeline.x_step = 30;
timeline.x_size = 24;
timeline.x_start = 16;
timeline.x_length = 48;
timeline.second_scale = false;
if (dayScale != 0){
scheduler.xy.scale_height = scheduler.xy.scale_height/2;
dayScale = 0;
} else {
scheduler.xy.scale_height;
};
scheduler.setCurrentView();
break;
case "2":
timeline.x_unit = "day";
timeline.x_date = "%j %D";
//timeline.x_date = "%Y-%m-%d";
scheduler.templates.timeline_scale_date = function(date){
var func=scheduler.date.date_to_str(timeline.x_date);
return func(date);
};
timeline.x_step = 1;
timeline.x_size = 7;
timeline.x_start = 0;
timeline.x_length = 7;
scheduler.templates.timeline_second_scalex_class = function(date){
return "";
};
/* timeline.second_scale = {
x_unit:"week",
x_date: "Week %W"
}; */
setScaleHeight(dayScale);
scheduler.setCurrentView();
break;
case "3":
timeline.x_unit = "day";
timeline.x_date = "%j";
//timeline.x_date = "%Y-%m-%d";
scheduler.templates.timeline_scale_date = function(date){
var func=scheduler.date.date_to_str(timeline.x_date);
return func(date);
};
timeline.x_step = 1;
timeline.x_size = 30;
timeline.x_start = 0;
timeline.x_length = 30;
timeline.second_scale = {
x_unit:"month",
x_date: "%F"
};
scheduler.templates.timeline_second_scale_date = function(date){
var func = scheduler.date.date_to_str(timeline.second_scale.x_date);
return func(date);
};
setScaleHeight(dayScale);
scheduler.setCurrentView();
break;
case "4":
timeline.x_unit = "month";
timeline.x_date = "%F";
scheduler.templates.timeline_scale_date = function(date){
var func=scheduler.date.date_to_str(timeline.x_date);
return func(date);
};
timeline.x_step = 1;
timeline.x_size = 12;
timeline.x_start = 0;
timeline.x_length = 12;
timeline.second_scale = {
x_unit:"year",
x_date: "%Y"
};
scheduler.templates.timeline_second_scale_date = function(date){
var func = scheduler.date.date_to_str(timeline.second_scale.x_date);
return func(date);
};
setScaleHeight();
scheduler.setCurrentView();
break;
}
}
function tempday(){
updateTimeline('1');
}
function tempWeek(){
updateTimeline('2');
}
function tempMonth(){
updateTimeline('3');
}
</script>
</head>
<body onload="init();">
<div id="scheduler_here" class="dhx_cal_container" style="width:100%; height:100%;">
<div class="dhx_cal_navline">
<div class="dhx_cal_prev_button"> </div>
<div class="dhx_cal_next_button"> </div>
<div class="dhx_cal_today_button"></div>
<div class="dhx_cal_date"></div>
<div name="day_tab" onclick="tempday();" style="right:204px;"></div>
<div class="" name="week_tab" onclick="tempWeek();"style="right:140px;"></div>
<div class="" name="month_tab" onclick="tempMonth(); " style="right:76px;"></div>
<div class="dhx_cal_tab" name="timeline_tab" "style="right:76px;"></div>
<!-- <div ><input type="button" value ="Load options" onclick="loadOptions()"></div> -->
</div>
<div class="dhx_cal_header">
</div>
<div class="dhx_cal_data">
</div>
</div>
</body>
</html>
Don’t know I using the open connector in correct way or not ? whatever the document I think I using in that way only . Please suggest where I a am missing?