2 Answers, 1 is accepted
0
Hello Seaman,
In order to calculate the Kendo UI Grid column value you need to use aggregates and footerTemplate.
I believe you might find this online demo helpful as it discusses the same subject.
the Telerik team
In order to calculate the Kendo UI Grid column value you need to use aggregates and footerTemplate.
I believe you might find this online demo helpful as it discusses the same subject.
Regards,
Iliana Nikolovathe Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Lee
commented on 15 May 2013, 03:44 AM
Top achievements
Rank 1
Is there not a way to simply sum a complete column and display it in the footer of the grid?
For example.. I have a grid with 5 columns, 4 of which display numbers (integers). I would like to have a "Totals" line at the bottom of the grid, and under the 4 columns with the numbers I would like to sum each column.
Grouping does not work for this, as they are simple output of daily counts.. and grouping on each one would mean that each and every row would become a group.
Thanks...
For example.. I have a grid with 5 columns, 4 of which display numbers (integers). I would like to have a "Totals" line at the bottom of the grid, and under the 4 columns with the numbers I would like to sum each column.
Grouping does not work for this, as they are simple output of daily counts.. and grouping on each one would mean that each and every row would become a group.
Thanks...
Iliana Dyankova
commented on 18 May 2013, 08:01 AM
Telerik team
Hello Christian,
You could achieve this using footerTemplate for each of the columns. As an example:
the Telerik team
You could achieve this using footerTemplate for each of the columns. As an example:
$(
"#grid"
).kendoGrid({
//....
columns: [
{ field:
"UnitPrice"
, title:
"Unit Price"
, footerTemplate:
"Total: #=sum#"
},
{ field:
"UnitsOnOrder"
, title:
"Units On Order"
, footerTemplate:
"Total: #=sum#"
}
//....
]
});
Regards,
Iliana Nikolovathe Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Marvin
commented on 27 Jun 2013, 11:41 AM
Top achievements
Rank 1
I have a similar problem, I'm creating a shopping list grid. There's a Price (bound column) and I need to calculate the Total Price dynamically based on the Quantity that the user will input. Am I missing something? Or do I need events here? The Total Price is always 0..
var gridResult = $("#grid").kendoGrid({
dataSource: {
type: "aspnetmvc-ajax",
// type: "json",
transport: {
read: "Home/Products_Read"
},
schema: {
data: "data",
total: "total",
model: {
id: "Id",
fields: {
Number: { editable: false },
Name: { editable: false },
Supplier: { editable: false },
Price: { editable: false, type: "number" },
Quantity: { editable: true, type: "number" }
}
}
},
pageSize: 20,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
selectable: "row",
sortable: true,
pageable: true,
columns: [
{ field: "Number", title: "Number", width: "100px" },
{ field: "Name", title: "Name" },
{ field: "Supplier", title: "Supplier", width: "100px" },
{ field: "Price", title: "Price", width: "100px", format: "{0:n}" },
{ field: "Quantity", title: "Quantity", width: "100px", template: '<
input
data-role
=
"numerictextbox"
data-bind
=
"value: Quantity"
data-max-value
=
"100"
class
=
"quantityTextArea"
/>' },
{ title: "Total Price", width: "100px", template: "#= Price * Quantity #" }
]
});
Nathan
commented on 24 Mar 2014, 05:16 PM
Top achievements
Rank 1
A full code sample would be nice, not just a fragment of code. So annoying
0
Luciano
Top achievements
Rank 1
answered on 25 Mar 2014, 07:42 AM
Here I edited the online demo and removed grouping. Scroll down to the bottom and check the second column, it has a total sum in the footer.
Nathan
commented on 25 Mar 2014, 11:14 AM
Top achievements
Rank 1
Luciano, thanks for the reply. I don't use jquery to load my grids. Plus I use a lot of razor syntax. I was able to figure out a temporary workaround without having to do a lot of jquery
thanks
thanks