Dec 06, 2012, 1:47 PM
[CLOSED] 2 functions in the render event
Hi
I am having a trouble with the grouping option in the grid panel.
I need the average of the the column, for getting the average I use the SummaryType="Average" in the GroupingSummaryColumn, and in the Render I use the <Renderer Format="Round" FormatArgs="2" />
But I also need to color the columns, I have a method for coloring which is the following
The problem is that just one of the two functions works. Or rounds the number or color it. No both.
Here is part of my code
I attach a screenshot so you can observe the final result.
I am having a trouble with the grouping option in the grid panel.
I need the average of the the column, for getting the average I use the SummaryType="Average" in the GroupingSummaryColumn, and in the Render I use the <Renderer Format="Round" FormatArgs="2" />
But I also need to color the columns, I have a method for coloring which is the following
var RenderColor = function (value, meta, record, rowIndex, colIndex) {
var valor = value;
var color = "#";
if (colIndex == 4 && record.data.R == "255")
{ color = color + "FF"; }
else if (colIndex == 4)
color = color + "00";
if (colIndex == 4 && record.data.G == "255")
color = color + "FF";
else if (colIndex == 4)
color = color + "00";
if (colIndex == 4 && record.data.B == "255")
color = color + "FF";
else if (colIndex == 4)
color = color + "00";
if (colIndex == 2 && record.data.R2 == "255")
color = color + "FF";
else if (colIndex == 2)
color = color + "00";
if (colIndex == 2 && record.data.G2 == "255")
color = color + "FF";
else if (colIndex == 2)
color = color + "00";
if (colIndex == 2 && record.data.B2 == "255")
color = color + "FF";
else if (colIndex == 2)
color = color + "00";
if (colIndex == 5 && record.data.R3 == "255")
color = color + "FF";
else if (colIndex == 5)
color = color + "00";
if (colIndex == 5 && record.data.G3 == "255")
color = color + "FF";
else if (colIndex == 5)
color = color + "00";
if (colIndex == 5 && record.data.B3 == "255")
color = color + "FF";
else if (colIndex == 5)
color = color + "00";
meta.attr = 'style="background-color:' + color + ';"';
return value;
}
I also called it in the render.The problem is that just one of the two functions works. Or rounds the number or color it. No both.
Here is part of my code
<ext:GroupingSummaryColumn DataIndex="RQI2" Header="RQI" Width="15" Sortable="false"
SummaryType="Average">
<b> <Renderer Fn="RenderColor" Format="Round" FormatArgs="2" /></b>
<Editor>
<ext:NumberField ID="NumberField2" runat="server" AllowBlank="false" StyleSpec="text-align:left" />
</Editor>
</ext:GroupingSummaryColumn>
<ext:GroupingSummaryColumn DataIndex="Diff" Header="Dif" Width="15" Sortable="false"
SummaryType="Average">
<b><Renderer Format="Round" FormatArgs="2" /></b>
<b><Renderer Fn="RenderColor" /></b>
<Editor>
<ext:NumberField ID="NumberField3" runat="server" AllowBlank="false" StyleSpec="text-align:left" />
</Editor>
</ext:GroupingSummaryColumn>
I have try several way and no result.I attach a screenshot so you can observe the final result.
Last edited by Daniil; Dec 12, 2012 at 11:15 AM.
Reason: [CLOSED]