Change text color according footer value

Posted by: jairojosuehernandez on 26 October 2021, 6:44 am EST

    • Post Options:
    • Link

    Posted 26 October 2021, 6:44 am EST

    i have a flex grid in MVC, with this configuration ```

    @(Html.C1().FlexGrid()

    .Id(“panel_by_periods”)

    .CssClass(“table-style”)

    .AutoGenerateColumns(false)

    .Bind(bi => bi.BatchEdit(Url.Action(“Save”)).DisableServerRead(true))

    .IsReadOnly(true)

    .AutoClipboard(true)

    .SortingType(C1.Web.Mvc.Grid.AllowSorting.SingleColumn)

    .AllowAddNew(false)

    .SelectionMode(C1.Web.Mvc.Grid.SelectionMode.None)

    .ShowColumnFooters()

    .Columns(bl =>

    {

    bl.Add(cb => cb.Binding(“period”).Header(“Periodo”).Width(“*”).IsReadOnly(true));

    bl.Add(cb => cb.Binding(“travels”).Header(“Viajes”).Width(“60”).Name(“travels”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Sum));

    bl.Add(cb => cb.Binding(“litters”).Header(“Litros”).Width(“70”).Name(“litters”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Sum));

    bl.Add(cb => cb.Binding(“km”).Header(“km”).Width(“70”).Name(“km”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Sum));

    bl.Add(cb => cb.Binding(“performance”).Header(“km/l”).Width(“40”).Name(“performance”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Avg));

    bl.Add(cb => cb.Binding(“cost”).Header(“Costo”).Width(“70”).Name(“cost”).Format(“c”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Sum));

    bl.Add(cb => cb.Binding(“kmxl”).Header(“$km/l”).Width(“40”).Name(“kmxl”).Format(“c”).Aggregate(C1.Web.Mvc.Grid.Aggregate.Sum));

    }).ItemFormatter(“format”)

  • Posted 28 October 2021, 7:35 pm EST

    Hello,

    We apologize for the delay in response. Please refer to the following points to implement the above requirement:

    • We may use the itemFormatter property which is used to customize cells of FlexGrid.
    • Within the above function, we use the getCellData() method of GridPanel class to get the value of the cell and may compare it with the Footer Cell’s value and may set the desired text color of cells accordingly.

    Please refer to the below sample.

    FlexGrid_Footer.zip

    Regards

    Dushyant Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels