Seems I cant figure out anything on my own. Anyway, looking to set a total for a column in the footer. I see examples for the UltraWebGrid but nothing for the WebDataGrid. Thanks.
Hello,
At this time the WebDataGrid does not support this feature. It will be included in future version of the control.
You can use a template within the column footer that can display total of that column.
-Taz.
I am trying to update the footer (during editing) by utilizing Javascript on the CellChanged event but need to know how to access the Footer row in CSOM.
If that cant be done, any other way on keeping the footer template label updated?
Btw, I'm using Clientside event because the server-side ActiveCellChanged and/or CellSelectionChanged events dont seem to be firing when I changed cells.
Actually, instead of using a template you can directly use the "Text" of the footer to set a display value within the columns footer. In Javascript, you can capture the footer element using the "_footerElement" property off of the column object. But, this is an internal property at the moment. I will put it as a feature request so that this is supported as a public property so that it can be used for cases like this.
var grid = $find("WebDataGrid1");
var col = grid.get_columns().get_column(0);
col._footerElement.innerText = "New Value";
Is there a way to access the footer text in the server-side code? I need to calculate and fill the footer totals after data binding.
Yes, there is a Footer subobject off the BoundDataField, which has a Text property:
<ig:BoundDataField DataFieldName="Description" Key="Description" Width="400px">
<Header Text="Description" />
<Footer Text="blah" />
</ig:BoundDataField>
Thanks, for anyone's reference, I used the following example:
WebDataGrid1.Columns("ColName").Footer.Text = TotalSum.ToString
Was there ever an update that allowed you to set the footer text client-side?
Nice hack on the formatting.
Only problem I run into is that I update the footer using the _footerElement.innerText property and therefore loses the text-align property after update. Anyone know which property I need to change to keep the formatting?
If it helps anybody, I used the prior post and .NET's DataTable.Compute to get nice totals. I had to set the CssClass for the footer as well, using !important in a few spots to override the Appletini theme I'm using (code is C#):
gridLease.FooterCaptionCssClass = "gridFooter"; gridLease.Columns["CurrentBalance"].Footer.Text = String.Format("{0:C}", Convert.ToDecimal(table.Compute("Sum([Current Balance])", ""))); gridLease.Columns["FutureActivity"].Footer.Text = String.Format("{0:C}", Convert.ToDecimal(table.Compute("Sum([Future Activity])", ""))); gridLease.Columns["ItemsOutstanding"].Footer.Text = "<p style=\"text-align: center\">" + table.Compute("Sum([ItemsOutstanding])", "").ToString() + "</p>";
Note the hack-y way that I set the text of one column to contain a paragraph with inline center style and override the right-align for one column.
Cheers,
John