Unplanned
Last Updated: 16 Feb 2023 11:31 by ADMIN
Dan
Created on: 02 Feb 2023 14:07
Category: TreeList
Type: Bug Report
1
treelist display no record template at the same time as the status template

When you have configured the norows with a text and the server does not respond with a valid answer instead of displaying only the status you get to see both the norecords template and the failed status template.

There should be only one of them visible and the failed status template should take precedence.

5 comments
ADMIN
Aleksandar
Posted on: 16 Feb 2023 11:31

Hi Dan,

I have observed the behavior with Kendo UI for jQuery as well and have discussed it with the Dev Team and agree this is indeed an unexpected behavior. 

You can monitor this item for further details on the issue. Unfortunately, currently I cannot provide a workaround for the behavior.

Regards,
Aleksandar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Dan
Posted on: 09 Feb 2023 11:39

Hi Aleksandar,

Like I already said in a previous post the problem was that I was canceling changes on error event because the my tree list supports only delete action.

On your sample if you add Scrollable(false) and in the errorHandler you add the code $('#treelist').getKendoTreeList().cancelChanges();

you will see that both templates appear, although the pageable makes the status template outside of the tree.

ADMIN
Aleksandar
Posted on: 09 Feb 2023 11:17

Hello Dan,

Can you provide a sample where the behavior reported can be reproduced? I have tried to reproduce the behavior, but have failed to observe both.

@(Html.Kendo().TreeList<EmployeeDirectoryModel>()
    .Name("treelist")
    .Columns(columns =>
    {
        columns.Add().Field(e => e.FirstName).Width(250).TemplateId("photo-template");
        columns.Add().Field(e => e.LastName).Width(160);
        columns.Add().Field(e => e.Position);
        columns.Add().Field(e => e.Phone).Width(200);
        columns.Add().Field(e => e.Extension).Width(140);
        columns.Add().Field(e => e.Address);
    })
    .Messages(m=>m.NoRows("Custom No Records message"))
    .Filterable()
    .Sortable()
    .DataSource(dataSource => dataSource
        // error in response
        .Read(read => read.Url("https://run.mocky.io/v3/f958a79e-1f6c-46ce-9d89-b883d1b0f25d"))
        // no error in response
        //.Read(read => read.Url("https://run.mocky.io/v3/f0950ca6-fbb2-4c23-ae6a-8d2be044662d"))
        .ServerOperation(false)
        .Model(m => {
            m.Id(f => f.EmployeeId);
            m.ParentId(f => f.ReportsTo);
            m.Expanded(true);
            m.Field(f => f.FirstName);
            m.Field(f => f.LastName);
            m.Field(f => f.ReportsTo);
        })
        .Events(ev=>ev.Error("errorHandler"))
    )
    .Height(540)
    .Pageable(p => p.PageSize(15)
                    .PageSizes(true)
    )
)
<script>
    function errorHandler(e){
        if(e.errors){
            e.preventDefault()
            alert(`${e.errors[0].myError}` )
        }
    }
</script>

I used a mock endpoint to return some sample data. If the request is successful and no contains no records and no errors only the custom message is displayed.

{
    "Data": [],
    "Total": 0,
    "AggregateResults": {},
    "Errors": null
}

If the request contains errors only "Request failed" message is displayed and the error handler alerts the error message:

{
    "Data": [],
    "Total": 0,
    "AggregateResults": {},
    "Errors": [{ "myError" : "error message" }]
}

Here is a sample REPL where I tested this.

Please provide the TreeList configuration and the actual response so I can investigate further.

Regards,
Aleksandar
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.

Dan
Posted on: 02 Feb 2023 15:20

I identify the problem.

I also have an error handler where I cancel the changes since the treelist has support for destroy and I assumed that errors could come only from destroy.

I think that method cancelChanges should do better on handling when there are no changes to cancel.

Dan
Posted on: 02 Feb 2023 14:29
Please move the ticket to ASP.NET Core cause it seems that on the jquery it is not reproducible.