我有2个问题
var jsonObj = []; var jsonString = null;
$(document).ready(function () {
var url = test.siteUrl() + "/_vti_bin/omg/tt.svc/Read/" + _campaign.CampaignWebID + "/" + _campaign.CampaignListID + "/" + _campaign.ID + "?t=" + of360.t();
$.getJSON(url, function (data) {
$.each(data, function (i) {
item = {}
item['ID'] = data[i].ID;
item['ChannelDescription'] = data[i].ChannelDescription;
item['Start'] = data[i].Start;
item['End'] = data[i].End;
item['PercentageComplete'] = data[i].BriefingState/10;
item['Name'] = data[i].Name;
jsonObj.push(item);
});
jsonString = JSON.stringify(jsonObj);
//regex : Json remove quotes
jsonString = jsonString.replace(/"(\w+)"\s*:/g, '$1:');
//alert(jsonString);
});
});
var ganttModel = kendo.observable({
cancel: function () {
this.cancelDialog();
},
isVisible: true,
ganttDS: new kendo.data.GanttDataSource({
data: jsonString,
schema: {
model: {
id: "id",
fields: {
Id: { from: "ID", type: "number" },
start: { from: "BriefingStart", type: "date"},
end: { from: "BriefingEnd", type: "date" },
title: { from: "BriefingChannelDescription", type: "string" },
PercentageComplete: {from:"PercentageComplete", type: "number"}
}
}
}
})
});

<script id="ganttChartTemplate" type="text/x-kendo-template">
<div id="ganttchart">
<div class="modal-body">
<div class="row">
<div class="form-group">
<div data-role="gantt"
data-columns="[
{ field: 'title', title: 'Gattung', width: 100 },
{ field: 'start', title: 'Start Time', format: '{0:dd/MM/yyyy}', width: 100 },
{ field: 'end', title: 'End Time', format: '{0:dd/MM/yyyy}', width: 100 }
]"
data-views="[ 'day', { type: 'week', selected: true }, 'month' , 'year']"
data-show-work-hours="true"
data-show-work-days="true"
data-height="300"
data-editable="false"
data-listWidth="600"
data-toolbar="[""pdf""]"
data-pdfExport="true"
data-bind="source: ganttDS"></div>
</div>
</div>
<div class="k-dialog-buttons modal-footer">
<button class="k-button k-primary" data-bind="events: { click: cancel }">#= Resources.OF360.SendToBuyingDialogCancel#</button>
</div>
</div>
</div>
</script>
&#13;
感谢您的帮助。
答案 0 :(得分:0)
parse: function (response) {
$.each(response, function (idx, elem) {
var state = elem.BriefingState;
elem.BriefingState = state/11;
});
return response;
}
savePdf : function(){
var gantt = $("#gantt").data("kendoGantt");
gantt.saveAsPDF();
},