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. Image for the cookie policy date

Custom Column DropDownEdit don't work after last update

Hi.

I had some custom columns with DropDownEdit values, that were working, but after the last updated it stopped working.

Here is my example:

<script type="text/x-jsrender" id="columnTemplate">
    <div style='height:20px;width:20px;margin:auto; background-repeat:no-repeat;'>{{:#data['disciplina']}}</div>
</script>

@(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)        
    .ClientSideEvents(eve =>
    {
        eve.Load("load");
    }
)

function load(args) {
        var columns = this.getColumns();
        columns.splice(9, 0,
            {
                field: "disciplina",
                mappingName: "disciplina", //Provide this mapping name
                headerText: "Disciplina",
                columnTemplate: true,
                editType: "dropdownedit",
                dropdownData: disciplinas,
                templateId: "columnTemplate",             
                width: "160px"
            });
}

The variable disciplinas is updated after each post to the server to load Gantt. I even tried to call manually the load function but it didn't work.

What should I have to change in my code to get it working?

Thanks,
Otto Machado.

8 Replies

MK Mahalakshmi Karthikeyan Syncfusion Team February 3, 2016 08:47 AM UTC

Hi Otto,

We were not able to reproduce the issue while loading custom column with drop down data in Gantt with latest Essential studio version (13.4.0.53). We have also tried your code and it worked successfully for us. Can you please share us more details about the issue in which instance you are facing? Also can you please share us what type of data you are passing as drop down data? It will be helpful for us to provide appropriate solution for your query.

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/GanttSample379834948

If you still face any issue please get back to us by modifying this sample along with the replication procedure to reproduce it.

Regards,

Mahalakshmi K.



OM Otto Moura Machado Filho February 3, 2016 04:50 PM UTC

Thanks for your reply.

But I'm not able to run it. My problem is that I have a combobox that reload Gantt. So when user change value of combobox, I have the code below:

$.ajax({
            type: "POST",
            url: "Atividade/LoadGanttAtividade",
            data: { idprojeto: idprojeto }
        })
        .success(function (data, st) {
            Ext.get(document.body).unmask();
            if (st == "success") {
                disciplinas = data.disciplinas; //<<<<<<<<<<<<<------------------------- this line used to attach the new value for my custom column, but it seems that function load is not called anymore after changing the value of combobox.
                status_atividade = data.status;
                ganttObject.option("resources", data.resources);
                if (data.grid.length == 0) {
                    ganttObject.option("scheduleStartDate", data.initialDate);
                    ganttObject.option("dataSource", []);
                    //ganttObject.setModel({ dataSource: []});
                }
                //ganttObject.setModel({ dataSource: data.grid, scheduleStartDate: data.initialDate/*, resources: data.resources, toolbarSettings: { showToolbar: true }*/ });
            }
}

I tried this too:                 ganttObject.option("disciplina", data.disciplinas);
but didn't work too.

So, as I said, my problem is to refresh values of this custom column after reload Gantt.

Thanks,
Otto Machado.


MK Mahalakshmi Karthikeyan Syncfusion Team February 4, 2016 12:46 PM UTC

Hi Otto,

We have analyzed the code you have shared and found that there was a missing code to assign the new list the custom column which is returned from server. Please refer the below code example for details.

[CSHTML]

var disciplinas = [{ ResourceId: "value1", ResourceName: "value1" }, { ResourceId: "value2", ResourceName: "value2" }];


       function load(args) {

           var columns = this.getColumns();

           columns.splice(6, 0,

          {

              field: "disciplina",

              mappingName: "disciplina", //Provide this mapping name

              headerText: "Disciplina",

              columnTemplate: true,

              editType: "dropdownedit",

              dropdownData: disciplinas,

              editParams: { fields: { text: "ResourceName", value: "ResourceName" } },

              templateId: "columnTemplate",

              width: "160px"

          });

       }


$.ajax({

           type: "POST",

           url: "Gantt/loadGantt",

           success:(function (data, st) {

       if (st == "success") {

           var ganttObject = $("#Gantt").data("ejGantt");

           var column = ganttObject.getColumns();

           column[6].dropdownData = data[0].resource;

           ganttObject.setModel({ dataSource: data[0].Datasource, toolbarSettings: { showToolbar: false } });

       }

           }),

          

       })


[CS]

public ActionResult loadGantt(dataset list) {

            List<dataset> lists=new List<dataset>();

            var dataSource = GanttDefaultData.GetData1();

            var resource = ResourceList.GetResources1();

            lists.Add(new dataset()

                {

                    Datasource = dataSource,

                    resource = resource,});

            return Json(lists, JsonRequestBehavior.AllowGet);


        }

Here we have changed the custom column data and the Gantt data source which was returned from server using AJAX post method.

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/GanttSample-477677874

Regards,

Mahalakshmi K.



OM Otto Moura Machado Filho February 4, 2016 06:39 PM UTC

Thanks. Now it's working.

Otto Machado.


OM Otto Moura Machado Filho February 4, 2016 07:12 PM UTC

Still about custom columns: I have a custom column for currency, that after update is showing $0.00. My locale is pt-BR, and I want to show R$ 0,00.

I have a file with some info about locale, like this:

ej.Gantt.Locale["pt-BR"] = {
    //string to display with dataSource contains 0 objects
    emptyRecord: "Sem registros.",

    //headerText to be displayed in gridtree
    columnHeaderTexts: {
        taskId: " ",
        taskName: "Atividade",
        startDate: "Data de Início",
        endDate: "Data de Término",
        resourceInfo: "Recursos",
        duration: "Duração",
        status: "Progresso",
        predecessor: "Predecessor",
        type: "Tipo",
        offset: "Compensar",
        baselineStartDate: "Data de início da linha de base",
        baselineEndDate: "Linha de Base End Date"
    },

Is there any configuration here, or any other way to use R$ instead of $?

Here is my custom column:

columns.splice(12, 0,
            {
                field: "custo_direto",
                mappingName: "custo_direto", //Provide this mapping name
                headerText: "Custo Direto",
                columnTemplate: true,
                templateId: "columnTemplate",
                width: "120px",
                editType: "numericedit",
                format: "{0:C2}",
                editParams: { decimalPlaces: 2, incrementStep: 0.01, minValue: 0 }
            });

Thanks,
Otto Machado.


MK Mahalakshmi Karthikeyan Syncfusion Team February 5, 2016 12:14 PM UTC

Hi Otto,

For the locale support we have introduced ej.globalize method to support all the culture related functionalities that are previously supported. The ej.globalize method works without any disruption even when used along with Globalize 0.9 to Globalize 1.0 versions.Also we provide en-US Locale text object, which gives user flexibility to convert it or create their own local language object with some simple modifications. You find all the modified supported Syncfusion locale files from the following Essential studio installed location.

File Location: C:\Program Files (x86)\Syncfusion\Essential Studio\13.4.0.53\JavaScript\assets-src\scripts\cultures

We have given brief description about this in our online help documentation, which can be found from the following link.

Documentation

We have also prepared a sample in your locale language and you can find the sample under the following location.

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/GanttSample182275739

Regards,

Mahalakshmi K.



OM Otto Moura Machado Filho February 5, 2016 06:28 PM UTC

I'm importing the new culture file and now it's working.

Thanks,
Otto Machado.


MK Mahalakshmi Karthikeyan Syncfusion Team February 8, 2016 04:21 AM UTC

Hi Otto,

Thanks for the update.

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

Regards,

Mahalakshmi K.


Loader.
Up arrow icon