[CLOSED] TemplateHtml : Sum colum values

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] TemplateHtml : Sum colum values

    Hi I need to sum of a column values end of the row,my code sample is bellow.

    @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]

Similar Threads

  1. [CLOSED] Loop through TemplateHtml in RowExpander
    By matrixwebtech in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 21, 2014, 9:10 AM
  2. [CLOSED] How to redim colum in GridPanel
    By egvt in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 31, 2012, 5:30 PM
  3. Colum editor Focus
    By angelolsantos in forum 1.x Help
    Replies: 0
    Last Post: Feb 10, 2010, 8:33 AM
  4. Row and Colum Layout in same page
    By Sameera in forum 1.x Help
    Replies: 2
    Last Post: Jan 13, 2010, 1:27 PM
  5. Colum renderer
    By Filip Beunens in forum 1.x Help
    Replies: 6
    Last Post: Mar 31, 2009, 1:41 PM

Tags for this Thread

Posting Permissions