Scheduler does not refresh/reload new data onChange of Combo

Hi,

In a page, to the left I have a form that has a dhtmlx combo within. To the right, I have a scheduler with events. Whenever the user selects an employee on combo on the left, the form is submitted and scheduler to the right is expected to load the selected employee’s events. I see the new data in my server application logs too. but its not getting refreshed on the scheduler. It displays old data that was loaded when the page was loaded the first time. Subsequent changes in dropdown selection is expected change the events in the scheduler accordingly.Could you please say how I can solve this?

[code]

// In the beginning of the , I have

var tracDataJSONStr = ‘<%=session.getAttribute(“eventsdata”)%>’
var tracDataJSON;
if (undefined != tracDataJSONStr && null != tracDataJSONStr){
tracDataJSON = JSON.parse(tracDataJSONStr);
}

// This is the JSON Events string from my server logs:
eventsdata = {“totalRecords”:2,“data”:[{“id”:“611339”,“an8”:“444540”,“c_eddse”:“01/02/2017”,“start_date”:“2017-01-02”,“end_date”:“2017-01-02”,“start_time”:“08:00 AM”,“end_time”:“05:00 PM”,“req_type”:“HL-Holiday”,“status”:“Approved”,“created_date”:“10/30/2016 07:15:18”,“text”:“Autopopulated holiday”},{“id”:“611340”,“an8”:“444540”,“c_eddse”:“04/14/2017”,“start_date”:“2017-04-14”,“end_date”:“2017-04-14”,“start_time”:“08:00 AM”,“end_time”:“05:00 PM”,“req_type”:“HL-Holiday”,“status”:“Approved”,“created_date”:“10/30/2016 07:15:18”,“text”:“Autopopulated holiday”}]}

// IN function init() I have the below 2 lines
scheduler.parse(tracDataJSON.data, “json”);
scheduler.updateView();

// In function doOnLoad()
var myLayout4 = new dhtmlXLayoutObject({
parent: “layoutObj4”,
header: false,
pattern: “1C”
});
var layoutObj4 = document.getElementById(“layoutObj4”);
var subordinates = ‘${subordinates}’;
var arrStr = JSON.parse(subordinates);
myLayout4.cells(“a”).setText(“Team:”); // THIS IS MY DROPDOWN LIST.

var formReporteesData = [
{type: “settings”, position: “label-top”, inputWidth:225},
{type: “combo”, name: “combo_zone_reportees”, id: “combo_zone_reportees”, label: “” },
{type: “hidden”, name: “mySelectedReporteeName”, label:"", id:“mySelectedReportee”, hidden: true},
{type: “hidden”, name: “mySelectedReporteeValue”, label:"", id:“mySelectedReporteeValue”, hidden: true}
];
var myReporteesForm = myLayout4.cells(“a”).attachForm(formReporteesData);
var myReporteesCombo = myReporteesForm.getCombo(“combo_zone_reportees”);
myReporteesCombo.addOption([{value: “0”, text: “DIRECT REPORTS”, selected: true}, {value: “1”, text: “ALL REPORTS”}]);
var data = arrStr.data.map(function(obj){
return {
value:obj.yaan8,
text: obj.name
};
});
myReporteesCombo.addOption(data); // MY DROPDOWN LIST
myReporteesCombo.readonly(true);

myReporteesCombo.attachEvent(“onChange”, function (){
var name = myReporteesCombo.getSelectedText();
var num= myReporteesCombo.getSelectedValue();
myReporteesForm.setItemValue(“mySelectedReporteeName”, name);
myReporteesForm.setItemValue(“mySelectedReporteeValue”, num);
myReporteesCombo.confirmValue();
myReporteesForm.send("/MyProject/reportees.action", “get”,function(loader,response){
}); // I SEE THE Events JSON VALUES IN MY SERVER APPLICATION LOGS
}); [/code]

Hello,

scheduler.parse(tracDataJSON.data, "json"); scheduler.updateView();
scheduler.parse updates Scheduler by default, it’s not necessary to update it again by scheduler.updateView.

myReporteesCombo.attachEvent("onChange", function (){ var name = myReporteesCombo.getSelectedText(); var num= myReporteesCombo.getSelectedValue(); myReporteesForm.setItemValue("mySelectedReporteeName", name); myReporteesForm.setItemValue("mySelectedReporteeValue", num); myReporteesCombo.confirmValue(); myReporteesForm.send("/MyProject/reportees.action", "get",function(loader,response){ }); // I SEE THE Events JSON VALUES IN MY SERVER APPLICATION LOGS });
As for the issue, you have received new data then not loaded it to Gantt Chart. You can use gantt.parse() to refresh data.

I have somewhat similar problem:

I am using dhtmlx-scheduler as follows:

From a dropdown(react-select), I choose a name (whose events I have to show on the scheduler) and it shows correctly,

nextState.showData is an array of data.
window.scheduler.parse(nextState.showData, ‘json’)

but when I deselect the same name, the scheduler should update and show me no events, but the scheduler does not update(and still shows the event for the name which is now deselected)

Although, on deselect of the name,
nextState.showData=[]

Please help. I am using dhtmlx-scheduler with React…

Hello @Sonal215

You can check my reply in this topic Dhtmlx-scheduler with React

Please don’t repost the same question in multiple threads in the future.