Hi Guys
I am trying to download data from controller using a button on view, I want to download data using ViewBag to a Gantt control.
I am using asp net core 3.1 and EJ2 with latest nuget packages with little success, please point me in the right direction
The ViewBag I am using works if i use it when view opens with normal data manager dataSource="ViewBag.dataSource"
but does not work when using javascript below
I want to only load Gantt chart data when down load button is triggered and not when view opens.
Example Javascript used
document.getElementById('getData').onclick = function() {
reloadData();
};
function test() {
setTimeout(function() {
gridData = '@Html.Raw(Json.Serialize(ViewBag.dataSource))';
alert(gridData);var gridObj = document.getElementById('Gantt')['ej2_instances'][0];
gridObj.dataSource = gridData;
gridObj.refresh();
}, 3000);
}
function reloadData() {
var obj = document.getElementById("Gantt").ej2_instances[0];
var newData = new ej.data.DataManager({
url: '/GanttChart/GetMyData',
adaptor: new ej.data.UrlAdaptor,
crossDomain: true
});
test();
Your help would be appreciated
Regards
Edmund Herbert