Long task names on PDF Export

1 Answer 94 Views
Gantt
Mariam
Top achievements
Rank 1
Iron
Iron
Veteran
Mariam asked on 24 May 2021, 11:25 AM

Hi,

I have a task with long name and after exporting it to pdf, name is shown partially.

I tried to change width of the column before exporting and reset it after it:

let columns = $("#gantt").getKendoGantt().options.columns; columns[3].width = 1500; $("#gantt").getKendoGantt().setOptions({columns: columns}); outerThis.gantt.saveAsPDF();

but it broke my gantt chart, because I have other methods in databound and databinding which resets after setOptions.

 

I also tried to change height of my rows, but it broke dependencies like shown in Screenshot(120).

 

How can I solve this problem? Is there any way to change only the width of the column without changing other things?


Thanks 

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 27 May 2021, 09:46 AM

Hi Mariam,

You can accomplish that by utilizing the pdfExport event, preventing it during option changes and reverting the changes. 

var _PREVENT = true;
          
var gantt = $("#gantt").kendoGantt({
              	pdfExport: function (ev) {
                  if(_PREVENT){
                    ev.preventDefault();
                    _PREVENT = false;
                    var gantt = ev.sender;
                    var columns = gantt.options.columns;
                    var originalWidth = columns[0].width;
										columns[0].width = 1500;
                    gantt.setOptions({columns: columns});
                		ev.sender.saveAsPDF().done(function(){
                      _PREVENT = true;
                      columns[0].width = originalWidth;
                      gantt.setOptions({columns: columns});
                    });
                  }
                },
...
Here you are a dojo example: https://dojo.telerik.com/@iankodj/IzIYUmuL/3

Regards,
Ianko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Gantt
Asked by
Mariam
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Ianko
Telerik team
Share this question
or