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

ScrollToDateTime

4 Answers 66 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Druoton
Top achievements
Rank 1
Druoton asked on 27 Jun 2016, 01:49 PM

Hi Telerik Team, you are doing an amazing work but today I need some more information.

 

I need to focus the gantt view on a task while double clicking on its name.

I look forward something like the "ScrollToDateTime" function or something like that.

I already tried this solution : http://www.telerik.com/forums/scroll-to-current-day but it could not find the ".bind" property of the "._widget".

 

I also need to directly open a popup after the insertion of a new task. The problem is that I can't find the task ID in the OntaskInsert event.

 

Could you please help me ?

4 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 30 Jun 2016, 12:44 PM
Hi,

I have tested the code from the forum linked and it worked correctly at my side. At your side you are most probably not finding the Gantt object correctly.
Here is the similar code that helped me open the edit form immediately:
function pageLoad() {
               $find("RadGantt1")._widget.bind("dataBound", ganttDataBound);
               $find("RadGantt1")._widget.bind("add", add);
           }
           var flag;
           function add(e) {
               flag = e.task.uid;
           }
 
           function ganttDataBound(e) {
               var view = $find("RadGantt1")._widget.timeline.view();
               var viewStart = view.start;
               var viewEnd = view.end;
               var currentDate = new Date();
 
               if (flag) {
                   e.sender.editTask(flag);
                   flag = false;
               }
           }

Hope this will help you solve the issue.

Regards,
Plamen
Telerik
0
Druoton
Top achievements
Rank 1
answered on 05 Jul 2016, 11:47 AM

Hi Plamen,

You are right, I was not finding the gantt object correctly.
If I try to access to the "_widjet" object outside of the "ganttDataBound" event, it is not working.

So, here is my question :
How could I do to use the "$find("RadGantt1")._widget.timeline.view();" then the "view.content.scrollLeft(offset);" from the code behind using the ScriptManager.RegisterStartupScript ?

I need to change the view of the gantt from a click on a button for instance.

 

Thank you for you help.

0
Plamen
Telerik team
answered on 07 Jul 2016, 08:10 AM
Hi,

In such case we would rather recommend to change the view on the server side as in the code below:
protected void Unnamed_Click(object sender, EventArgs e)
    {
        RadGantt1.SelectedView = Telerik.Web.UI.GanttViewType.WeekView;
    }

and provide the scroll in the pageLoad client event after that. Hope this will help you solve the issue.

Regards,
Plamen
Telerik by Progress
0
Druoton
Top achievements
Rank 1
answered on 08 Jul 2016, 10:05 AM

Hi Plamen,

 

I made what I wanted to do with your solution.

 

Thank you very much for your help.

Tags
Gantt
Asked by
Druoton
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Druoton
Top achievements
Rank 1
Share this question
or