JSON response

Hello,

Is it possible to return the response dataprocessor as JSON.
And how should the response be like?

Regards,
Michiel Klaver

Hello,

Is it possible to return the response dataprocessor as JSON.

It is impossible. DataProcessor requires xml response. However, if you are using our Connector, the response is automatically generated.

if you do not want to use Connector, the response should as follows:

  • for update:


  • for insert:



    for delete:


Hello,

Thanks for the fast response.
My loader is in JSON, after updating the event I change the color of the event.
But these isn’t updating untill I refresh the page, how can I fix this?

The same problem I have with other fields that needs to be updated.

Regards,
Michiel Klaver

Hello,

did you refresh scheduler after the item property had been updated ?

$$(“scheduler”).item(id).color = “…”;
$$(“scheduler”).refresh(id);

[code]did you refresh scheduler after the item property had been updated ?

$$(“scheduler”).item(id).color = “…”;
$$(“scheduler”).refresh(id);[/code]

I tried it with this:

[code]$$(“scheduler”).data.attachEvent(“onStoreUpdated”,function(id,item,operation){

});[/code]

But here is the item.color still the old color and not the updated color.

Hello,

onStoreUpdated event takes id as a parameter only if a single item gets changed. After a set of data is loaded, the event takes null as a parameter. Moreover, refresh will call onStoreUpdated event.

Therefore, there correct usage would be as follows:

$$("scheduler").data.attachEvent("onStoreUpdated",function(id,item,operation){ if(id){ this.blockEvent(); $$("scheduler").item(id).color = "..."; $$("scheduler").refresh(id); this.unblockEvent(); } });

This approach allows to set event color after an event is added or edited.

But how do I get the new color, this color is set in the database and returned in the item variable.
When I log the item variable, I get the orginal color of the event, not the new color for the database.

Regards,
Michiel

I have it working with the following code:

dhx.dp($$("scheduler")).attachEvent("onAfterSync",function(obj){ for(i=0;i<obj.length;i++){ $$("scheduler").item(obj[i].tid).color = obj[i].color; $$("scheduler").item(obj[i].tid).relation_name = obj[i].relation_name; $$("scheduler").item(obj[i].tid).project_name = obj[i].project_name; } }); $$("scheduler").data.attachEvent("onStoreUpdated",function(id,item,operation){ if(id){ this.blockEvent(); $$("scheduler").refresh(id); this.unblockEvent(); } });

But the “scheduler.templates.selected_event” isn’t updating, how do I fix this?

But the “scheduler.templates.selected_event” isn’t updating, how do I fix this?

Try to use the template as it is in the attachment.
template.zip (621 Bytes)

Hi Alexandra,

I believe I use it on the same way as your attachment, this is what I use:

[code]scheduler.templates.selected_event = function(obj,type){
var html = “”;
if(!obj.start_date) return html;
html += “

”;
html += “
”;
if(obj.project_name!=null && obj.project_name!=""){
html += obj.project_name;
}
if(obj.relation_name!=null && obj.relation_name!=""){
html += obj.relation_name;
}
html += “
”;
html += “
”+obj.text+"
";
var fds = scheduler.templates.event_date(obj.start_date);
var fde = scheduler.templates.event_date(obj.end_date);
var fts = dhx.i18n.timeFormatStr(obj.start_date);
var fte = dhx.i18n.timeFormatStr(obj.end_date);
html += “
van “+fds+” “+fts+”
”;
html += “
tot “+fde+” “+fte+”
”;
html += "</div>";
return html;

};
[/code]

Regards,
Michiel

onAfterSync is called after onStoreUpdated. Therefore, you need to call refresh item from this event handler