We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Add data to Gantt MVC 5 , being able to send all gantt data back to controller using ajax call

Thread ID:

Created:

Updated:

Platform:

Replies:

121460 Dec 16,2015 02:30 PM Dec 23,2015 07:38 AM ASP.NET MVC 10
loading
Tags: Gantt
Edmund Herbert
Asked On December 16, 2015 02:30 PM

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,

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 I am using
MVC 5 and

        <add assembly="Syncfusion.Compression.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ.Mvc, Version=13.3500.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.Linq.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.XlsIO.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.EJ.Olap,Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />
        <add assembly="Syncfusion.Olap.Base, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" />

Regards


Edmund Herbert

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On December 17, 2015 07:33 AM

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


Edmund Herbert
Replied On December 17, 2015 08:41 AM

Thank you very much your support is outstanding

Regards

Edmund Herbert

Edmund Herbert
Replied On December 17, 2015 12:19 PM

Hi Dinesh

I did some tests on id one i set the start date and time and end date and time i noticed that the start time was out by 2 hours

please have a look at attached project

Regards

Edmund Herbert

Attachment: Mvc5GanttSample_193ea2ab.rar

Edmund Herbert
Replied On December 17, 2015 01:22 PM

Hi Guys my fault you save date as UCT then browser applies local in my case adds 2 hours

Anyway

Thanks for your excellent service

Regards

Edmund

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On December 18, 2015 12:04 AM

Hi Herbert,

Thanks for your update.

Please let us know, if you need further assistance on this.
Reagrds,
Dinesh kumar.N


Edmund Herbert
Replied On December 21, 2015 07:22 PM

Hi Dinesh

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

also how would i deal with a delete call

Regards Edmund

Mahalakshmi Karthikeyan [Syncfusion]
Replied On December 22, 2015 08:02 AM

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.


Edmund Herbert
Replied On December 22, 2015 02:44 PM

Hi Mahalakshmi

The example that you sent me is a workaround and technically fails because when adding a new record the update record event can and does sometimes fire first and then you code fails

I have sent other reports of this even mix-up  update event fires on add and update when are you going to fix problem

This is now very urgent please

Regards
Edmund Herbert




Edmund Herbert
Replied On December 22, 2015 02:46 PM

ok the fix is to upgrade to .18 version i will try this

Dinesh Kumar Nagarathinam [Syncfusion]
Replied On December 23, 2015 07:38 AM

Hi Edmund,

Thanks for your update.

Please let us know, if you need further assistance on this.

Regards,

Dinesh kumar.N


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;