Client event double click task

7 posts, 0 answers
  1. OfficeHeart
    OfficeHeart avatar
    99 posts
    Member since:
    Aug 2008

    Posted 23 Sep 2014 Link to this post

    Hello,

    Is it possible to attach a eventhandler to a double click event on a task and get the taskId?

    Thanks,
    Martin
  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 24 Sep 2014 Link to this post

    Hello Martin,

    You can attach a double click event handler manually and implement your logic there. Here's an example of how to get a task from inside a double click handler:
    function pageLoad() {
        var $ = $telerik.$;
        var gantt = $find("RadGantt1");
     
        $(".rgtTask").on("dblclick", function(e) {
            e.stopPropagation();
     
            var $element = $(e.target);
     
            if (!$element.is(".rgtTask")) {
                $element = $element.parents(".rgtTask").first();
            }
     
            var uid = $element.attr("data-uid");
            var tasks = gantt.get_allTasks();
            var task;
     
            for (var i = 0; i < tasks.length; i++) {
                if (tasks[i]._uid === uid) {
                    task = tasks[i];
                    break;
                }
            }
     
            console.log(task);
        });
     
    }


    Regards,
    Bozhidar
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. André
    André avatar
    1 posts
    Member since:
    Oct 2014

    Posted 29 Oct 2014 in reply to Bozhidar Link to this post

    this exemple return taskid not value column id. have to return the value of the id column of the selected row?
  5. Хосбаяр
    Хосбаяр avatar
    7 posts
    Member since:
    Jun 2013

    Posted 15 Jan 2015 Link to this post

    Trying get task id. Telerik version 2014 Q3

    Cannot read property 'get_allTasks' of null 

  6. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 16 Jan 2015 Link to this post

    Hi,

    Can you share your code (just the relevant part, demonstrating the Gantt and how you're using it), so that we can inspect it in order to find out why you might be getting this error.

    The most probable cause is that the following line is not getting the proper reference to the Gantt control:
    var gantt = $find("RadGantt1");

    This might be caused by several reasons:
    1. Your Gantt has a different ID
    2. Your Gantt is inside a naming container, causing its client ID to be different than the one specified in the markup. In this case try using the following syntax:
    var gantt = $find("<%= RadGantt1.ClientID %>");


    Regards,
    Bozhidar
    Telerik
  7. Хосбаяр
    Хосбаяр avatar
    7 posts
    Member since:
    Jun 2013

    Posted 16 Jan 2015 Link to this post

    Hello Bozhidar thank you for answering. previously error my bad  "different ID" . 

    now when i try new task or all postback actions give me error:

    Server Error in '/' Application.
    The state information is invalid for this page and might be corrupted

    Database from 
    http://www.telerik.com/help/aspnet-ajax/gantt-data-binding-database-structure.html

    Binding like 

    http://www.telerik.com/help/aspnet-ajax/gantt-data-binding-declarative-binding.html



  8. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 19 Jan 2015 Link to this post

    Hi,

    When you have new and different issues, please post them in a new forum thread (or in an old one discussing the particular issue), so that we can keep each forum thread concise and relevant to it's title. That way when another person searches through the forum he can more easily find a relevant topic.

    As for the issue at hand, again, without relevant code there's little we can say about the problem. Also, make sure you are using the official release of RadGantt (Q3 2014), rather than the beta release (Q2 2014), since there were some issues concerning databinding and CRUD operations that were addressed between the two versions.
     
    Regards,
    Bozhidar
    Telerik
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017