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

Retain the inline cell edit mode on update of Gantt when error occurs

1 Answer 96 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Anagha
Top achievements
Rank 1
Anagha asked on 28 Apr 2017, 10:24 AM

Hi,

I am trying to retain the edit mode of the cell in the Gantt Chart when the modelState has errors. 

<script>

function error(e) {
            var grid = $("#gantt").data("kendoGantt");
            grid.one("dataBinding", function(args) {
                e.preventDefault();
            });
            if (e.errors) {
                var msg = "";
                $.each(e.errors, function(key, value) {
                    if (value.hasOwnProperty("errors")) {
                        $.each(value.errors, function() {
                            msg += this + "<br />";
                        });
                    }
                });

             alert(msg);
            }
        }

</script>

 

@(Html.Kendo().Gantt<TaskGantt, TaskGanttDependency>()
    .Name("gantt")
    .DataSource(ds => ds
                        .Read(read => read
                            .Action("Tasks", "Home")
                        )
                        .Update(update => update
                            .Action("Update", "Home")
                        )
                        .Events(events => events
                          .Error("error")
                        )
                        .Model(m =>
                        {
                            m.Id(f => f.Id);
                            m.ParentId(f => f.ParentId);
                            m.OrderId(f => f.OrderId);
                            m.Field(f => f.Expanded).DefaultValue(true);
                        })
                    )
                    .DependenciesDataSource(ds => ds
                        .Read(read => read
                            .Action("Dependencies", "Home")
                        )
                        .Model(m =>
                        {
                            m.Id(f => f.DependencyId);
                            m.PredecessorId(f => f.PredecessorId);
                            m.SuccessorId(f => f.SuccessorId);
                            m.Type(f => f.Type);
                        })
                    )
                    
    .Columns(columns =>
    {
        columns.Bound("title").Editable(true).Sortable(true);
        columns.Bound("end").Title("End Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(true).Sortable(true);  
    })
    .Views(views =>
    {
        views.WeekView(weekView => weekView.Selected(true));
        views.MonthView();
    })
    .Events(events=> events
        .DataBound("onDataBound")
    )
    .Height(500)
    .ShowWorkHours(false)
    .ShowWorkDays(false)
    .Snap(false)
    .Resizable(true)
    )

I have used the above code, but i am not able to retain the edit mode for a single cell when the ModelState has errors.I have attached the image of how the gantt chart should look after update is called and ModelState returns error.

Can i get to know if I have missed any thing or any other approach is there to carry on with the requirement.

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 02 May 2017, 09:42 AM
Hello Anagha,

I am afraid that currently there is no built-in way with which you can retain the edit mode of a cell. Also you will not be able to prevent the cell from exiting edit mode with e.preventDefault().

If you think that this is a must-have feature and if you would like to have it implemented in a future release of Kendo UI, you can submit a new feature request in our Feedback portal.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 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
Anagha
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or