This is a migrated thread and some comments may be shown as answers.

Customized Gantt

7 Answers 107 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Salvatore
Top achievements
Rank 1
Salvatore asked on 26 Jun 2018, 01:16 PM

Hi

I allow myself to relaunch you on topics that have not had answers to know  : 

If is there a way to show week numbers rather dates ? is it possible to modify radGantt WeekHeaderDateFormat like this  : Week 15, Week 16...

If there is a way to customize the pop-up window, prevent click action on a task or call a custom window ?

 

tested with the product version : 2018.2.516.45

Best regards

7 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 28 Jun 2018, 10:50 AM
Hello Salvatore,

Showing "Week 1" functionality can be achieved with the following JavaScript based on the Gantt Localization demo.

What you should add to the Gantt markup declaration is the WeekView-WeekHeaderDateFormat="dd/MM/yyyy" and OnClientDataBound="OnClientDataBound" properties.

<telerik:RadGantt RenderMode="Lightweight" runat="server" ID="RadGantt1" SelectedView="WeekView" AutoGenerateColumns="false"    Height="640px" DataSourceID="TasksDataSource" WeekView-WeekHeaderDateFormat="dd/MM/yyyy" OnClientDataBound="OnClientDataBound"
        DependenciesDataSourceID="DependenciesDataSource">

function getWeekNumber(d) {
    // Copy date so don't modify original
    d = new Date(Date.UTC(d.getFullYear(), d.getMonth(), d.getDate()));
    // Set to nearest Thursday: current date + 4 - current day number
    // Make Sunday's day number 7
    d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
    // Get first day of year
    var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
    // Calculate full weeks to nearest Thursday
    var weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
    // Return array of year and week number
    // return [d.getUTCFullYear(), weekNo];
    return weekNo
}
function OnClientDataBound(sender, args) {
    if (sender.get_viewsData()[sender.get_selectedView()].type == "week") {
        $telerik.$('.rgtTimelineWrapper thead>tr:first .radHeader', sender.get_element()).each(function (index) {
            var $this = $(this)
            var datestring = $this.text().substring(0, 10);
            var date = new Date(datestring);
            var weekNumber = getWeekNumber(date)
            $this.text("Week " + weekNumber)
        })
    }
}

We have created a Feature request in our Feedback portal where you can cast your vote and subscribe - Allow templates for HeaderDateFormat in RadGantt.

Regarding the Custom edit window, please check the Custom Task Edit Window article - https://docs.telerik.com/devtools/aspnet-ajax/controls/gantt/how-to/custom-task-edit-window 

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Salvatore
Top achievements
Rank 1
answered on 29 Jun 2018, 09:38 AM

Thank you, 

Great ! I managed to display the list of weeks.

On the other hand, I can not modify the Localization even after having the example.

I wonder if it does not miss a file in the directory bin or other ...

I continue with the custom edit window article.

Regards,

Salvatore

 

0
Peter Milchev
Telerik team
answered on 04 Jul 2018, 12:34 PM
Hello Salvatore,

The Localization is not working in the sample project as the resource files are missing from the App_GlobalResources folder. 

Attached is an archive with the Resources files for many controls which can be found in the demos you might have installed locally.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Salvatore
Top achievements
Rank 1
answered on 05 Jul 2018, 08:12 AM

Hi Peter,

Thank's

I have a problem when I add a control button,

<asp:Button ID="Button1" runat="server" Text="Button" />

after putting a breakpoint when I click on it, I do not go into the event ... 

 

Regards,

Salvatore

0
Peter Milchev
Telerik team
answered on 05 Jul 2018, 10:16 AM
Hello Salvatore,

Are there any JavaScript errors in the browser console and did you subscribe correctly to the event of the button? 

As this is not related to the original topic of this thread, would you please open a new thread with the button issue? You can prepare a simple sample runnable project replicating the issue and attach it to an official support ticket for us to investigate it locally.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Salvatore
Top achievements
Rank 1
answered on 05 Jul 2018, 03:35 PM

Peter,

I'm sorry, I did a wrong thing. Would it be possible to delete the two tickets I just created so that I can create a new one with the test project.

I did not have any JavaScript errors...

Regards,

Salvatore

0
Peter Milchev
Telerik team
answered on 06 Jul 2018, 07:14 AM
No worries Salvatore,

I have answered in the other thread where we can continue the discussion.

For convenience, I am sharing the link to the thread related to your button query - https://www.telerik.com/forums/event-click-doesn't-work-with-gantt.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Gantt
Asked by
Salvatore
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Salvatore
Top achievements
Rank 1
Share this question
or