Hi Team,
I have been trying to add data to Y-Unit dynamically. When I have no data for the Y-UNIT elements, I want to collapse/hide them.
I’m loading Campaign & Channels by default as Y-Unit, when I create timeline view.
We are loading the data from our server. While loading we would like to load only the elements that has the data, else we want to hide/remove them.
Please find the attached screenshots for more clear understanding. So In my context, i want to have only campaigns, and hide channels.
Below are the code snippets.
function OnPageLoad() {
scheduler.config.xml_date = “@ViewBag.XML_DATE_FORMAT”;
scheduler.config.fix_tab_position = false;
scheduler.config.show_loading = true;
scheduler.config.first_hour = 0;
scheduler.config.last_hour = 0;
scheduler.config.scroll_hour = 0;
scheduler.config.multi_day = true;
scheduler.config.limit_time_select = true;
scheduler.locale.labels.section_location = “Location”;
scheduler.config.prevent_cache = true;
scheduler.config.drag_create = false;
scheduler.config.dblclick_create = false;
scheduler.config.start_on_monday = true;
scheduler.config.start_day_line_on_monday = true;
dhtmlXTooltip.config.className = 'dhtmlXTooltip tooltip';
dhtmlXTooltip.config.timeout_to_display = 50;
dhtmlXTooltip.config.delta_x = 15;
dhtmlXTooltip.config.delta_y = -20;
scheduler.locale.labels.day_line_tab = "Week";
scheduler.locale.labels.week_line_tab = "Day";
scheduler.attachEvent("onViewChange", function (new_mode , new_date){
LoadData();
});
scheduler.attachEvent("onBeforeDrag", function (id, mode, e){
return false;
});
scheduler.attachEvent("onClick", function (id, e){
var mode = scheduler.getState().mode;
if (mode == "year"){
var s=id.split("_");
displayobj(s[1],s[2]);
}
return false;
})
scheduler.attachEvent("onDblClick", function (id, e){
var s=id.split("_");
displayobj(s[1],s[2]);
return false;
})
var currentTime = new Date();
scheduler.init('scheduler_here', new Date(currentTime.getFullYear(), currentTime.getMonth(),currentTime.getDay()),'month');
date = scheduler.date.week_start(scheduler.getState().date);
var url = ['@Url.Action](mailto:'@Url.Action)("GetRequiredTypes")';
$.ajax({
type: 'GET',
url: url,
dataType: "json",
success: function (evt) {
var currentTime = new Date();
scheduler.createTimelineView({
name: "day_line",
x_unit: "day",
x_date: "%D, %j-%M",
x_step: 1,
x_start : 0,
x_size: 7,
x_length: 7,
y_unit: evt,
y_property:"section_id",
render: "bar"
});
}
});
LoadData();
}
function LoadData() {
scheduler.setLoadMode("month");
var currentTime = new Date();
if(startdate == null){schedulerdate = scheduler.getState().date;}
if(enddate == null) { enddate = getMonthEnd(schedulerdate);}
var url = ['@Url.Action](mailto:'@Url.Action)("load")';
var arg = null;
var start = getMonthStart(schedulerdate);
arg = "?id=" + viewID +"×hift=0&from="+start+"&to="+enddate;
url = url + arg;
var data = [];
$.ajax({
type: 'GET',
url: url,
dataType: "json",
success: function (evt) {
var innertext='[';
for(var i=0;i<evt.length;i++)
{
data.push({
start_date:evt[i].start_date,
end_date:evt[i].end_date,
text:evt[i].text,
section_id:evt[i].type,
color:evt[i].color,
id:evt[i].id
});
}
scheduler.parse(data,"json");
}
});
}
Can you please help me in this regard??
Thanks in advance.