Hi Herbert,
Query : Hi I notice if I add a new record to Gantt and select a resource , resource is not added if I edit record and select resource and add then it is displayed,
Solution : We request you to set the name of resource id field same for both TaskData and Resources Datasources. Also make sure with the column name of SQL table and Entity Framework Table.
Code Snippet:
[CS] // Gantt Data Fields public class TaskData { public string TaskId { get; set; } public string TaskName { get; set; } //... public List<int> ResourceID { get; set; } //...
} // Resource Data Fields public class myDropDown { public string ResourceID { get; set; } public string ddtext { get; set; } }
[CSHTML]
@(Html.EJ().Gantt("Gantt"). TaskIdMapping("TaskId"). //...
//To Set the resources
ResourceInfoMapping("ResourceID").// "Resource" which is defined in Gantt data object ResourceIdMapping("ResourceID").//"ResourceID" which is defined in Resource datasource ResourceNameMapping("ddtext"). //"ddtext" which is defined in Resource datasource.
//...
) |
Query : I urgently need information on how to get resource selection back to controller (all gantt data) I have looked at you java-script actioncomplete function
I need to get complete Gantt record back to controller so that I can save it to sql database, the saving is not the problem but getting it back to controller.
Solution : We can get the complete Gantt Data from parameters (args.data.item) of ActionComplete client side event, in this item collection for resource reference we have passed the Resource ID alone, if we want complete resource details of a particular gantt record then we can get it by args.data.resourceInfo.
Code Snippet:
<script type="text/javascript"> function ActionComplete(args) {
//Complete Gantt Data Details. var GanttData = args.data.item, //Complete Resource Details of particular Gantt Record. ResourceDetail = args.data.resourceInfo; } </script> |
We have prepared a sample based on your above requirement, find the sample from below location.
Sample: http://www.syncfusion.com/downloads/support/forum/121460/ze/Mvc5GanttSample1404533793
Please let us know, if you need further assistance on this.
Regards,
Dinesh kumar.N
Hi Herbert,
Thanks for your update.
Please let us know, if you need further assistance on this.
Reagrds,
Dinesh kumar.N
Hi Edmund,
Query1: I note that in your example if I add a new record then in the controller the add as well as the update functions are called is this correct, I thought if adding then only the add function would be called
Solution: We can also reproduce the behavior as reported, the ActionComplete requestType “recordUpdate” will trigger for newly added row also in the Essential studio version 13.3.0.7. But we have changed this behavior to trigger ActionComplete only once with requestType as “save” for newly added row in our latest Essential studio version 13.3.0.18. We recommend you to upgrade to this version to overcome this issue.
Query2: also how would i deal with a delete call
Solution: we can also delete the selected row to the data base with the help of ActionComplete requestType as “delete”. Please refer the below code example for details.
@(Html.EJ().Gantt("Gantt"). //… ClientSideEvents(eve=>{ eve.ActionComplete("ActionComplete"); }). ) <script type="text/javascript"> function ActionComplete(args) { //… if (args.requestType === 'delete') { var deletedRecord = args.data.item; $.ajax({ type: "POST", url: "/TreeGrid/Delete", //Update is Server side method data: deletedRecord, }); } } </script> |
We have also prepared a sample based on this and you can find the sample under the following location.
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/Mvc5GanttSample1154052449
Regards,
Mahalakshmi K.
Hi Edmund,
Thanks for your update.
Please let us know, if you need further assistance on this.
Regards,
Dinesh kumar.N