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

Custom Add Task Popup

3 Answers 127 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
SDI
Top achievements
Rank 1
SDI asked on 05 Apr 2018, 10:59 AM
I decided to start a new thread instead of hijacking another, which i already did. Regardless, i am hoping Telerik can help with capturing the "Add Task" command and implementing my own custom popup. You have it for Edit Tasks, now is there a way for Add Tasks? This seems like a pretty common routine with other Telerik controls. I just dont see a way in your documentation and the limited client-side methods. Please help

3 Answers, 1 is accepted

Sort by
0
Clement
Top achievements
Rank 1
answered on 02 Jul 2018, 09:48 AM

Hi,

I'm also interested in this !
i have found how to open a new pop-up !
you need to put in your pageLoad() function this :

$(".rgtActions").on("click", function (e) {
                    showNewDialog();
                });
but i havent been able to work around the event of taskInsert from the gantt ! my pop-up open but the event also fired and update the gantt.

0
Clement
Top achievements
Rank 1
answered on 03 Jul 2018, 09:30 AM

Hi,

ok, i have found a work around this problem.
you need to hidden the add button present in the gantt with this :
.k-button, .radButton.rgtCreateButton {
    display:none;
}

 

Then you juste need too create a new button in this place in the pageLoad() javascript function like this :

var element = document.createElement("input"); 
                element.type = "button";
                element.value = "Add New";
                element.id = "btNew";
                element.className = "radButton";
                element.onclick = function () {
                    showNewDialog();// put the show is this method !
                };
                var foo = $('.rgtHeader');
                //Append the element in page (in span).
                //create the button if he is not already existing
                if ($('#btNewEvent').length == 0)
                    foo.append(element);

 

now you can create your popup like you want !

good luck !

 

0
Peter Milchev
Telerik team
answered on 04 Jul 2018, 03:39 PM
Hello Clement,

In order to use a custom insert Popup, I recommend you review the https://docs.telerik.com/devtools/aspnet-ajax/controls/gantt/how-to/custom-task-edit-window How to article.

Regarding the button itself, you can try the following code to show a custom dialog:

<script type="text/javascript">
    function pageLoadHandler() {
        var gantt = $find("<%= RadGantt1.ClientID %>");
        $telerik.$(gantt.get_element()).find(".rgtActions").on("mousedown", function (e) {
            if ($telerik.$(e.target).closest(".rgtCreateButton").length > 0) {
                e.stopPropagation();
                // call custom dialog
            }
        });
    }
    Sys.Application.add_load(pageLoadHandler);
</script>

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
SDI
Top achievements
Rank 1
Answers by
Clement
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or