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.

Gantt don't load my json

Thread ID:

Created:

Updated:

Platform:

Replies:

121682 Jan 15,2016 01:09 PM Jan 18,2016 11:47 AM ASP.NET MVC 1
loading
Tags: Gantt
Otto Moura Machado Filho
Asked On January 15, 2016 01:09 PM

Hi , I try to load gantt but  when i load a huge data the browser stop to work

the json has 1304 rows;

I put my json in attachament; Can you help with this problem

@(Html.EJ()
    .Gantt("AtividadeGantt")
    .Locale("pt-BR")   
    .TaskIdMapping("TaskID")        
    .IncludeWeekend(false)
    .EnableResize(true)
    .TaskNameMapping("TaskName")
    .ChildMapping("SubTasks")
    .StartDateMapping("StartDate")
    .EndDateMapping("EndDate")
    .DurationMapping("Duration")                                
    .ProgressMapping("Progress")
    .PredecessorMapping("Predecessor")
    .ResourceInfoMapping("ResourceID")
    .ResourceIdMapping("ResourceID")
    .ResourceNameMapping("ResourceName")    
    .HighlightWeekends(true)
    .SplitterPosition("50%")
    .TreeColumnIndex(1)        
    .AllowGanttChartEditing(true)
    .AllowSelection(true)
    .AllowColumnResize(true)
    .EnableVirtualization(true)
    .EnableContextMenu(false)    
    .ToolbarSettings(toolbar =>
    {
        toolbar.ShowToolbar(true);
                                  
        toolbar.ToolbarItems(new List<GanttToolBarItems>()
        {                                           
            GanttToolBarItems.Add,
            GanttToolBarItems.Edit,
            GanttToolBarItems.Delete,
            //GanttToolBarItems.Update,
            GanttToolBarItems.Cancel,
            GanttToolBarItems.Indent,
            GanttToolBarItems.Outdent,
            GanttToolBarItems.ExpandAll,
            GanttToolBarItems.CollapseAll
        }
        );
    })
    .EditSettings(edit =>
    {
        edit.AllowEditing(true);
        edit.AllowAdding(true);
        edit.AllowDeleting(true);
        edit.EditMode("cellEditing");                
    })
    .EditDialogFields(eve =>
                    {
                        eve.Field("TaskName").Add();
                        eve.Field("StartDate").Add();                        
                        eve.Field("EndDate").Add();
                        eve.Field("Duration").Add();
                        eve.Field("ResourceID").Add();
                        eve.Field("disciplina").Add();//To display custom column        
                        eve.Field("status_atividade").Add();//To display custom column
                        eve.Field("custo_direto").Add();//To display custom column                        
                        eve.Field("Predecessor").Add();
                        
                    })
    .AddDialogFields(eve =>
            {
                eve.Field("TaskName").Add();
                eve.Field("StartDate").Add();
                eve.Field("EndDate").Add();
                eve.Field("Duration").Add();
                eve.Field("ResourceID").Add();
                eve.Field("disciplina").Add();//To display custom column
                eve.Field("status_atividade").Add();//To display custom column
                eve.Field("custo_direto").Add();//To display custom column
                eve.Field("Predecessor").Add();             
            })
    .StripLines(eve=>
       {
           eve.Label("Hoje").Day(DateTime.Now.ToString("dd/MM/yyyy"))
               .LineColor("Darkblue").LineStyle("dotted")
               .LineWidth(2).Add();
       })                         
    .ClientSideEvents(eve =>
    {
        eve.Load("load");
        eve.ActionComplete("ActionComplete");
        eve.BeginEdit("beginEdit");
        eve.ActionBegin("CheckDelete");
        eve.Create("ganttCreate");
        //eve.ContextMenuOpen("contextMenuOpen");
    })    
    .DateFormat("dd/MM/yyyy")       
    .ScheduleStartDate(ViewBag.initialDate)
)
this is my load event 

function LoadGrid(id) {
        //For retrieving the Gantt control object
        
        var ganttObject = $("#AtividadeGantt").data("ejGantt");
 
        //ganttObject.setModel({ enableContextMenu: true });
 
        Ext.getBody().mask('Carregando...');
 
        $.ajax({
            type: "POST",
            url: "Atividade/LoadGanttAtividade",
            data: { idprojeto: idprojeto }
        })
        .success(function (data, st) {            
            Ext.get(document.body).unmask();            
            if (st == "success") {
                disciplinas = data.disciplinas;
                status_atividade = data.status;
                ganttObject.model.resources = data.resources;
                if (data.grid.length == 0)
                    ganttObject.setModel({ dataSource: [], scheduleStartDate: data.initialDate/*, resources: data.resources, toolbarSettings: { showToolbar: true }*/ });
                else
                    ganttObject.setModel({ dataSource: data.grid, scheduleStartDate: data.initialDate/*, resources: data.resources, toolbarSettings: { showToolbar: true }*/ });                
            }
            else {
                Ext.Msg.alert({
                    title: "Atenção",
                    msg: "Não foi possível carregar os dados",
                    buttons: Ext.Msg.OK,
                    icon: Ext.MessageBox.WARNING                    
                });               
            }
        })
        .error(function (XMLHttpRequest, textStatus, errorThrown) {
            Ext.get(document.body).unmask();
            Ext.Msg.alert({
                title: "Atenção",
                msg: "Não foi possível carregar os dados",
                buttons: Ext.Msg.OK,
                icon: Ext.MessageBox.WARNING
            });            
        });     
    }
Best regards,
Otto

Attachment: data_deda4446.rar

Jayakumar Duraisamy [Syncfusion]
Replied On January 18, 2016 11:47 AM

Hi Otto,

We regret for the inconvenience caused.

We have analysed the reported issue with your sample code and dataSource. We are unable to reproduce the issue. Because, LoadGrid() method was not called from anywhere and also we can’t render control without initial dataSource at load event. Hence we suggest you to use Create event to render control with your json dataSource. Please refer the below code snippet to render control by create event.


<script src="~/Scripts/data.js"></script> // json data


@(Html.EJ().Gantt("AtividadeGantt")   

    .TaskIdMapping("TaskID")

    .IncludeWeekend(false)

    .EnableResize(true)

         //…

         .ClientSideEvents(eve =>

    {

        eve.Create("ganttCreate");       

    })

)

@(Html.EJ().ScriptManager())

    <script type="text/javascript">             

        function ganttCreate(args) {           

        var ganttObj = $("#AtividadeGantt").data("ejGantt");      

        ganttObj.option("dataSource", data);


    }     

    </script>


We have also prepared a sample for your reference. Please find the sample in the following URL.

Sample: http://www.syncfusion.com/downloads/support/forum/121682/ze/MVCsampleSQL-805249858
Please let us know if you require further assistance on this.

Regards,

Jayakumar Duraisamy


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.

;