Hi,
I'm trying to get Server Aggregates working on my grid and I can't seem to get them to show up. Server grouping, sorting, and filtering are all working until I return the aggregates and then the grid no longer renders the data.
There seems to be an issue in writing the group footer. I get the error on the call to that.groupFooterTemplate(group.aggregates) inside the grid's _groupRoiwHtml function: "Uncaught ReferenceError: sum is not defined". I assume its either my groupFooterTemplate configuration or the actual aggregates I'm returning, but I can't figure it out.
Once I've got this working I'd also like to get the grid footer aggregates working, but I'm not sure where those are getting pulled from either.
I've put some of the relevant configuration below:
DataSource.schema.model
DataSource.group
DataSource.aggregate
Grid.columns
DataSource.schema.groups gets set to this:
Also, it would be awesome to have a sample out there that showed how to implement server-side everything (sort,filter,group,aggregates) so one could get an idea what the setup would look like...
Thanks!
Matt
I'm trying to get Server Aggregates working on my grid and I can't seem to get them to show up. Server grouping, sorting, and filtering are all working until I return the aggregates and then the grid no longer renders the data.
There seems to be an issue in writing the group footer. I get the error on the call to that.groupFooterTemplate(group.aggregates) inside the grid's _groupRoiwHtml function: "Uncaught ReferenceError: sum is not defined". I assume its either my groupFooterTemplate configuration or the actual aggregates I'm returning, but I can't figure it out.
Once I've got this working I'd also like to get the grid footer aggregates working, but I'm not sure where those are getting pulled from either.
I've put some of the relevant configuration below:
DataSource.schema.model
{
"fields"
: {
"TestContacts_ID"
: {
"editable"
:
false
,
"nullable"
:
true
,
"type"
:
"string"
},
"TestContacts_CompanyName"
: {
"editable"
:
false
,
"nullable"
:
true
,
"type"
:
"string"
}
}
}
DataSource.group
[
{
"field"
:
"TestContacts_CompanyName"
,
"dir"
:
null
,
"aggregates"
: [
{
"field"
:
"TestContacts_ID"
,
"aggregate"
:
"sum"
}
]
},
{
"field"
:
"TestContacts_ID"
,
"dir"
:
null
,
"aggregates"
: [
{
"field"
:
"TestContacts_ID"
,
"aggregate"
:
"sum"
}
]
}
]
DataSource.aggregate
[
{
"field"
:
"TestContacts_ID"
,
"aggregate"
:
"sum"
}
]
Grid.columns
[
{
"field"
:
"TestContacts_ID"
,
"title"
:
"ID"
,
"width"
: 75,
"format"
:
null
,
"template"
:
null
,
"aggregates"
: [
"sum"
],
"groupHeaderTemplate"
:
"ID: #= value #"
,
"groupFooterTemplate"
:
"Sum:#= sum #"
},
{
"field"
:
"TestContacts_CompanyName"
,
"title"
:
"CompanyName"
,
"width"
: 200,
"format"
:
null
,
"template"
:
null
,
"aggregates"
:
null
,
"groupHeaderTemplate"
:
"CompanyName: #= value #"
,
"groupFooterTemplate"
:
""
}
]
DataSource.schema.groups gets set to this:
[
{
"aggregates"
: {
"TestContacts_ID"
: 78.0
},
"field"
:
"TestContacts_CompanyName"
,
"value"
:
"MC 1"
,
"hasSubgroups"
:
true
,
"items"
: [
{
"aggregates"
: {
"TestContacts_ID"
: 25.0
},
"field"
:
"TestContacts_ID"
,
"value"
:
"25"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"TestContacts_ID"
:
"25"
,
"TestContacts_CompanyName"
:
"MC 1"
}
]
},
{
"aggregates"
: {
"TestContacts_ID"
: 26.0
},
"field"
:
"TestContacts_ID"
,
"value"
:
"26"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"TestContacts_ID"
:
"26"
,
"TestContacts_CompanyName"
:
"MC 1"
}
]
},
{
"aggregates"
: {
"TestContacts_ID"
: 27.0
},
"field"
:
"TestContacts_ID"
,
"value"
:
"27"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"TestContacts_ID"
:
"27"
,
"TestContacts_CompanyName"
:
"MC 1"
}
]
}
]
},
{
"aggregates"
: {
"TestContacts_ID"
: 57.0
},
"field"
:
"TestContacts_CompanyName"
,
"value"
:
"MC 2"
,
"hasSubgroups"
:
true
,
"items"
: [
{
"aggregates"
: {
"TestContacts_ID"
: 28.0
},
"field"
:
"TestContacts_ID"
,
"value"
:
"28"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"TestContacts_ID"
:
"28"
,
"TestContacts_CompanyName"
:
"MC 2"
}
]
},
{
"aggregates"
: {
"TestContacts_ID"
: 29.0
},
"field"
:
"TestContacts_ID"
,
"value"
:
"29"
,
"hasSubgroups"
:
false
,
"items"
: [
{
"TestContacts_ID"
:
"29"
,
"TestContacts_CompanyName"
:
"MC 2"
}
]
}
]
}
]
Also, it would be awesome to have a sample out there that showed how to implement server-side everything (sort,filter,group,aggregates) so one could get an idea what the setup would look like...
Thanks!
Matt