Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom sorting functions have wrong context #74

Open
lundmikkel opened this issue Apr 25, 2019 · 0 comments
Open

Custom sorting functions have wrong context #74

lundmikkel opened this issue Apr 25, 2019 · 0 comments

Comments

@lundmikkel
Copy link

The context (this) inside custom sorting functions point to the AureliaTableCustomAttribute instead of the code-behind class.

I have a code-behind class containing the following code:

public dateComparer(date1, date2, sortOrder) {
    return date1 === date2 ? 0 : ((date1 < date2 ? -1 : 1) * sortOrder);
}

public dateSort(a, b, sortOrder) {
    console.log(this);
    return this.dateComparer(a.date, b.date, sortOrder);
}

With an HTML table with aut-sort="custom.bind: dateSort" attribute on it. When sorting the column, I get the following message:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant