Declined
Last Updated: 27 Apr 2023 06:42 by ADMIN
Adam
Created on: 13 Apr 2023 14:30
Category: Grid
Type: Bug Report
0
grid sort indicator remains after setting sort to undefined

https://stackblitz.com/edit/angular-4bbepg?file=src%2Fapp%2Fapp.component.ts

@Component({
    selector: 'my-app',
    template: `
            <button class="btn btn-primary mb-3" (click)="toggleSort()">toggle sort</button>
            <kendo-grid
                [kendoGridBinding]="gridData"
                [filterable]="'menu'"
                [sortable]="true"
                [sort]="sort"
                [height]="400"
                [style.width.px]="400">
                <kendo-grid-column field="CompanyName"></kendo-grid-column>
            </kendo-grid>
        `
})
export class AppComponent {
    public gridDataCustomer[] = customers;
    sortSortDescriptor[];
    toggleSort() {
      this.sort = this.sort ? undefined : [{
        field: 'CompanyName',
        dir: 'desc'
      }]
    }
}

 

The sort indicator (down arrow) remains after removing the sort (setting the [sort] input to undefined)

Thanks,

-Adam

 

4 comments
ADMIN
Martin Bechev
Posted on: 27 Apr 2023 06:42

Hi Adam,

Thank you for your honest feedback.

I understand what is the desired outcome and see where the confusion comes from. But the sort property accepts a SortDescriptor array as an object type (instead SortDescriptor[] | undefined), which is why the column field and dir properties should be set, even if the sort order is undefined.

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

Adam
Posted on: 20 Apr 2023 14:07
In my opinion undefined should work. It's essentially identical to not setting it at all, which is supported. It should not be expected that developers pass in columns that don't need to be sorted just to handle a kendo display issue.
ADMIN
Martin Bechev
Posted on: 20 Apr 2023 08:41

Hi Adam,

Thank you for the provided details.

To correctly reset the column sorting order, the developer needs to set the dir property of the SortDescriptor to undefined instead of setting the sort property of the Grid to undefined.

Please check the updated example:

https://stackblitz.com/edit/angular-4bbepg-nbqc86

I hope this helps.

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

Adam
Posted on: 13 Apr 2023 14:31
This was meant to be filed under Angular, not jQuery. Thanks.