aurelia-ui-toolkits / aurelia-kendoui-bridge

MIT License
117 stars 31 forks source link

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

Open thejaff2 opened 4 years ago

thejaff2 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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?