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

Aggregates for grid defined in markup with multi column header does not work #804

Open
thejaff2 opened this issue Apr 6, 2020 · 2 comments

Comments

@thejaff2
Copy link

thejaff2 commented Apr 6, 2020

I can't get aggregates (total, not group) to work when using multi column headers declared in markup. When declared in javascript and bound with columns.bind it works. Se below gist

https://gist.run/?id=afeddc5feffc11797de0c01520804c06

@JeroenVinke
Copy link
Member

Hey @thejaff2

Take a look at this: https://gist.run/?id=af14d0b858609c497fd31919139a3887. Note the kendo-template.bind="true" on the <ak-template>'s.

Some background on this. When you supply a template to Kendo as a string { title: 'test', footerTemplate: '${count}' }, first the template parser of Kendo tries to parse the template. After that, the bridge uses Aurelia's template parser to parse the template. Unfortunately, Kendo's template parser does not like certain symbols that Aurelia's templating syntax has, and would throw an error, and Aurelia's templating parser wouldn't even be reached.

With some help from Telerik we found a (very old workaround in Kendo) to circumvent Kendo's template parser. This workaround is to pass templates in as a function instead of a string: { title: 'test', footerTemplate: (context) =>'${count}' }. This is quicker also because you only have one parser trying to parse the template 😄

Unfortunately, something seems to break when you use multi columns in a grid with aggregates, combined with templates supplied as a function, stopping other columns from rendering also (because when you comment out the first column, the other footer templates start to work again suddenly).

But, when you pass the template in as a string, it works for some reason... which is what the kendo-template.bind="true" does. Now, this is an option which we have disabled by default so I don't know what templates work and what templates don't work when you turn this option on.

I do think this is a bug in Kendo though, so my options to help you are limited

@thejaff2
Copy link
Author

thejaff2 commented Apr 7, 2020

Thanks! As you note at the end, it probably doesn't work for all templates. When using value converters it breaks, and also grouping becomes strange. Do you know if there is an related active bug report for this in Kendo base?

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

2 participants