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

some questions about gantt

Hi together

1. Is it possible to change the order of the columns in the tree grid via darg and drop and save it  then for the user?
2. How can the column chosser setting be saved per User?

Thanks for help

Martin

3 Replies

JD Jayakumar Duraisamy Syncfusion Team August 5, 2017 06:29 AM UTC

Hi Martin, 
Please find the response below, 
Query 1:  Is it possible to change the order of the columns in the tree grid via darg and drop? 
Answer: At present, we don’t have drag and drop support in Gantt. Hence, we have logged a feature report as “Support for column reordering in Gantt”. 
This feature can be tracked through our Feature Management. 
 
This feature will be implemented in any of our upcoming main release. 
Query 2: How can the column chooser setting be saved per User? 
Answer: We can save column chooser settings by button click action using Ajax post. We have prepared a sample that save column settings by custom toolbar item click action. For that enabled “toolbarClick” event and save the updated columns settings as string format to database using Ajax request.  
In the Column table, we have customerId column. Hence, we can save separate column settings per user. 
<ej:Gantt ID="Gantt" runat="server" ToolbarClick="toolbarClick" 
//.. 
> 
<ToolbarSettings ShowToolbar="true">  
             <CustomToolbarItems> 
                     <ej:GanttCustomToolbarItem Text="Save" TooltipText="Save" />                     
                </CustomToolbarItems>   
                </ToolbarSettings>   
</ej:Gantt> 
 
function toolbarClick(args){ 
                if (args.itemName == "Save") { 
                    var columns = args.model.columns, 
                        cName = [], cVisible = []; 
                    for (var i = 0; i < columns.length; i++) { 
                        if (columns[i].mappingName) { 
                            cName.push(columns[i].mappingName); 
                            cVisible.push(columns[i].visible); 
                        } 
                    } 
                    $.ajax({ 
                        type: "POST", 
                        url: '/GanttSample.aspx/updateColumnData', 
                        async: false, 
                        data: JSON.stringify({name:cName.toString() ,visible: cVisible.toString()}), 
                        contentType: "application/json; charset=utf-8", 
                        dataType: "json", 
                    }); 
 
                } 
            } 
In the load event, we can change the column order and visible property of the columns collection. At the load time, we have to pass the current customerId in the Ajax post to the server method and it will return the respective customer column settings details in the success method. Based on the saved column mapping name order and visible property, column will be render in the Gantt.  
function load(args) {                 
                var columns = this.getColumns(), 
                    cName = [],cVisible = []; 
                $.ajax({ 
//.. 
                 success: function (result) { 
                        var col = result.d; 
                        cName = col.Name.split(','), 
                    cVisible = col.Visible.split(','); 
                    } 
}) 
                 for (var i = 0; i < cName.length; i++) { 
                    var temp = {},cIndex = -1; 
                    $.each(columns, function (index, col) { 
                        if (col.mappingName == cName[i]) { 
                            col.visible = cVisible[i] == "true"? true : false; 
                            temp = col; 
                            cIndex = index; 
                            return false; 
                        } 
                    });                     
 
We have prepared a sample for your reference. Please find the sample location as below, 
Please let us know, if you required any other assistant. 
Regards, 
Jayakumar D 



MS Martin Sickel August 6, 2017 01:28 PM UTC

Thanky you

One of the best Supports I have ever seen :-)



JD Jayakumar Duraisamy Syncfusion Team August 7, 2017 04:19 AM UTC

Hi Martin, 
Thanks for the update. 
Regards, 
Jayakumar D 


Loader.
Up arrow icon