Feb 28, 2015, 1:50 PM
[CLOSED] TemplateHtml : Sum colum values
Hi I need to sum of a column values end of the row,my code sample is bellow.
also its help full if you can let me know how to set background color of TemplateHtml.
@model System.Collections.IEnumerable
@{
ViewBag.Title = "Row Expander Plugin with server side data";
}
<h1>Row Expander Plugin with server side data</h1>
@Html.X().ResourceManager()
@(
Html.X().GridPanel()
.Title("Expander Rows with server side data")
.Icon(Icon.Table)
.Width(600)
.Height(300)
.Store(Html.X().Store()
.DataSource(Model)
.Model(Html.X().Model()
.Fields(
Html.X().ModelField().Name("company")
)
)
)
.ColumnModel(
Html.X().Column().DataIndex("company").Text("Company").Flex(1)
)
.Plugins(
Html.X().RowExpander()
.Loader(Html.X().ComponentLoader()
.Mode(LoadMode.Data)
.Url(Url.Action("GetData"))
.LoadMask(mask => mask.ShowMask = true)
.Params(
new
{
company = JRawValue.From("this.record.data['company']"),
index = JRawValue.From("this.grid.store.indexOf(this.record)")
}
)
)
.TemplateHtml(@<text>
<table style="border-bottom:solid 1px #000000;
border-top:solid 1px #000000;
border-left:solid 1px #000000;
border-right:solid 1px #000000;">
<tr>
<th>
Sl No.
</th>
<th>
Company
</th>
<th>
Row ?
</th>
<th>
Server Date
</th>
</tr>
<tpl for=".">
<tr>
<td align="center">
{#}
</td>
<td align="center">
{company}
</td>
<td align="center">
{index}
</td>
<td>
{time}
</td>
</tr>
</tpl>
<tr>
<td></td>
<td></td>
<td style="border-bottom:solid 1px #000000;" align="center"></td>
</tr>
</table> </text>)
)
)
public class RowExpanderPluginwithserversidedataController : Controller
{
//
// GET: /RowExpanderPluginwithserversidedata/
public ActionResult Index()
{
return View(RowExpanderCompanies.GetAllCompanies());
}
public ActionResult GetData(string company, int index)
{
return this.Json(new object[]
{
new
{
company = company + "0",
index = index,
time = DateTime.Now.ToLongTimeString()
},
new
{
company = company + "1",
index = index + 1,
time = DateTime.Now.ToLongTimeString()
},
new
{
company = company + "2",
index = index + 2,
time = DateTime.Now.ToLongTimeString()
}
});
}
}
public class RowExpanderCompanies
{
public static IEnumerable GetAllCompanies()
{
DateTime now = DateTime.Now;
return new object[]
{
new object[] { "3m Co", 71.72, 0.02, 0.03, now },
};
}
}
I want to sum Row No column's values.how do I do this.also its help full if you can let me know how to set background color of TemplateHtml.
Last edited by Daniil; Mar 10, 2015 at 11:25 AM.
Reason: [CLOSED]