Is there a way to display only the SUM in the summaries instead of the SUM, MIN, MAX, AVG, and Count.
I basically want a Totals row at the bottom of my table with the SUM only of each column. Is that possible?
Hello Ryan,
Yes, that's possible. What you need to do is to specify that you need only the "SUM" displayed. This is achieved through the "columnSettings" object in the "features" array. Here is a code sample:
...
features: [
{
name: "Summaries",
columnSettings: [
{ columnKey: "ProductID", allowSummaries: true, summaryOperands: [ { "rowDisplayLabel": "Summary", "type", "SUM", "active": true } ] },
{ columnKey: "Name", allowSummaries: true, summaryOperands: [ { "rowDisplayLabel": "Summary", "type", "SUM", "active": true } ] },
{ columnKey: "ProductNumber", allowSummaries: true, summaryOperands: [ { "rowDisplayLabel": "Summary", "type", "SUM", "active": true } ] }
]
}
You need to specify for each column that, you need only the "SUM" operation. You can also refer to this sample. If you have any additional questions, please don't hesitate to ask.
Thanks,
Martin Stoev
Martin -
Thanks for the response. That actually worked this time. I tried it earlier but I must have missed something as it didn't work then.
Only issue I have left is that when I enable the summaries and set it to custom so I can get this, I still see the 4 blank extra rows. Is there a way to eliminate them down to only the one I am using?
Hello again,
So, in your code you have multiple "ColumnSetting" objects and in each one of those you have only one "SummaryOperand" object. What you should do is place all of the "SummaryOperand" objects in a single "ColumnSetting" object. It should be similar to this:
.ColumnSettings(cs => {
cs.ColumnSetting().ColumnKey("Custodian").SummaryOperands(so => {
so.SummaryOperand().RowDisplayLabel("Total Record Count").Type(SummaryFunction.Count).Active(true);
so.SummaryOperand().RowDisplayLabel("Total").Type(SummaryFunction.Sum).Active(true);
});
})
Try that and if that doesn't work I'll investigate it further.
I tried that and all it did was update the Custodian field in the grid. All of the other fields ended up getting the MIN, MAX, AVG, SUM and COUNT fields added.
Hi Ryan,
Which version of the jQuery product are you using? I still can't reproduce it on my side. Have you tried to set the "Active" property to "false" in all other fields? If that doesn't work, the problem might be in the MVC helpers' syntax. If you are able to describe the igGrid in the jQuery syntax (as in the first post reply), maybe that will work. Try these suggestions, and if none of them work for you, we'll investigate further.
I am using NetAdvantage for .NET 2013 Vol. 1 in my MVC project. I've tried to get it working with the jQuery syntax but no luck. I believe I am stuck with the MVC helper syntax at the moment.
Hi Martin,
So to fix this issue you should configure in Summaries in ColumnSettings explicitly all columns and which exactly summaries you want to activate. For instance if I have a grid with 5 columns you should set in column settings of summaries only the summary function that should be activated(in our case this should be Sum). As Martin said I can't replicate your issue but if I do not set in the columnKey the proper id (for instance I made a mistake or just do not keep in mind it is case sensitive) then I will have issue similar to you. Please check this code snippet:
@(
Html.Infragistics().Grid(Model)
.ID("Grid1")
.AnimationDuration(150)
.Features(feature =>
feature.Summaries().Type(OpType.Remote).CalculateRenderMode(SummaryCalculateRenderMode.OnSelect)
cs.ColumnSetting().ColumnKey("ProjectId").SummaryOperands(so =>
so.SummaryOperand()
.RowDisplayLabel("sUM1")
.Type(SummaryFunction.Sum)
.Active(true);
cs.ColumnSetting().ColumnKey("Name").SummaryOperands(so =>
so.SummaryOperand().Type(SummaryFunction.Sum).Active(true);
cs.ColumnSetting().ColumnKey("StartDate").SummaryOperands(so =>
cs.ColumnSetting().ColumnKey("EndDate").SummaryOperands(so =>
cs.ColumnSetting().ColumnKey("IsPostponed").SummaryOperands(so =>
)
.Columns(column =>
column.For(project => project.ProjectId).HeaderText("Project ID").DataType("number").Width("150px");
column.For(project => project.Name).HeaderText("Name").DataType("string ").Width("200px");
column.For(project => project.StartDate).HeaderText("Start Date").DataType("date").Width("240px");
column.For(project => project.EndDate).HeaderText("End Date").DataType("date").Width("240px");
column.For(project => project.IsPostponed).HeaderText("Is Postponed?").DataType("bool").Width("80px");
.PrimaryKey("ProjectId")
.DataBind().Render()
Miro
Yes, my answer was solved and no I do not need any further assistance. It was solved when my code was ported from vs2012 to vs2013 and the controls worked as intended. Thanks!
I am just checking if the latest reply helped you out or if you require any further assistance on the matter.
This sounds strange - can I ask you to compare the 2 html that is generated by the wrapper that you run in 4.0 and those in 4.5. I think they both should generate the same HTML code - and it is strange for me. Are you sure you are using the same configuration and the only difference is in Framework version.
I just ported my project over to VS2013 and running it on the 4.5 framework. Using the ".AutoGenerateColumn(false)" settings takes care of all of my issues and now everything is working great.
I am still wondering why I couldn't get it to work in 4.0 though. Thanks for the replies everyone.
So I've figured out why it wouldn't work, which doesn't really make sense to me.
There are a total of 22 fields in the IEnumerable that I am using for the datagrid. When I specify only the fields that I want from that I will get the extra column summary fields, even though they are blank. To get around this I have to manually set the other columns in the settings and set their hidden value to TRUE. Once you do this, you will get the desired results.
However, I am now getting another issues where no matter what size I set my first column's width to, it will not re-size. One problem down, another one up.