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

ClientTemplate removes percent drag handle

1 Answer 13 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 22 Apr 2021, 08:02 PM

When using a ClientTemplate the percent drag handle is not visible

<ClientTemplate>
<div
            <strong class="title">#= title # </strong>
</div>
</ClientTemplate>

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 27 Apr 2021, 08:02 PM

Hello Ken,

You can try the following ClientTemplate for the task along with some JavaScript in the OnClientDataBound event that will add the handle in the correct place:

<telerik:RadGantt OnClientDataBound="OnClientDataBound" ...>
<ClientTemplate>         
    <div class='rgtTaskComplete'  style="height:1.3em; width:#= 100 * parseFloat(percentComplete)#%" ></div>
    <div style="z-index:3; position:absolute; background-color:transparent; background-image:none">#= title #</div>
</ClientTemplate>

function OnClientDataBound(sender, args) {
    var tasks = sender.get_allTasks();
    // add percentage handle
    for (var i = 0; i < tasks.length; i++) {
        var $nodeWrap = $telerik.$(tasks[i].get_element().parentNode);
        if ($nodeWrap.hasClass("rgtTaskWrap") && $nodeWrap.find(".rgtDragHandle").length == 0) {
            $nodeWrap.append("<div class='rgtDragHandle' style='left:" + $nodeWrap.find('.rgtTaskComplete').width() + "px'></div>")
        }
    }
}

Regards,
Peter Milchev
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Gantt
Asked by
Ken
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or