RadiantQ Forum

Product => jQuery Gantt Package => Topic started by: dniezgoda on August 04, 2021, 08:15:04 AM

Title: Enter/Exit Edit mode in code behind
Post by: dniezgoda on August 04, 2021, 08:15:04 AM
Hi Team,

Is there any way to enter/exit edit mode from code behind for specific column cell?
eg. Enter edit mode for Name column right after adding new row to the gantt

Thank you in advance!
Title: Re: Enter/Exit Edit mode in code behind
Post by: Rajagopal on August 05, 2021, 10:28:06 AM
Hi dniezgoda,

Provide the unique cell class name to the column that you want to edit programmatically,

Code: [Select]
{
    field: "Activity_M().ActivityName_M()",
    title: "Activity Name",
    width: 150,
    cellClass: "nameCol",
    editor: RadiantQ.Default.Template.ProjectGanttExpandableTextboxEditor(),
    template: RadiantQ.Default.Template.ProjectGanttExpandableTextBlockTemplate()
}

And then get that specific column from the newly added activity view to make the cell into edit mode.

Code: [Select]
$("#addRow").click(function () {
    var newTask = getNewTask();
    ganttControl.AddNewItem(newTask);

    setTimeout(function () {
        var actView = ganttControl.ActivityViews[ganttControl.ActivityViews.length - 1];
        ganttControl.$ganttWrapper.data("GanttRowselectable").selectedItems.clear();
        // Select the row before start editing
        ganttControl.AddSelectedItem(actView);
        var $tr = ganttControl.grid.GetRowFromData(actView)
        var $td = $("td.nameCol", $tr);
        // To edit the cell
        ganttControl.grid.editCell($td);
    }, 100);
});

Thanks
Raja
Title: Re: Enter/Exit Edit mode in code behind
Post by: dniezgoda on August 11, 2021, 08:34:48 AM
it works like a charm!
Thanks a lot for your quick support.
Title: Re: Enter/Exit Edit mode in code behind
Post by: dniezgoda on October 18, 2021, 05:29:27 PM
one more thing, could you pls help me to commit a editing cell (Name column) from code behind?
For example:
When user create a new task and naming it but not hit Enter key to commit change instead he press a shotcut key to run another action.
In this case, the editing text cannot be commited to name column
Title: Re: Enter/Exit Edit mode in code behind
Post by: Rajagopal on October 19, 2021, 03:59:13 PM
Hi, We are looking on this, will update you soon.

Thanks,
Raja
Title: Re: Enter/Exit Edit mode in code behind
Post by: Rajagopal on January 17, 2022, 02:59:21 PM
We sent you the updated sample to your email. Please check and confirm it.