2 functions in the render event

  1. #1

    2 functions in the render event

    Hi
    I am having a trouble with the grouping option in the grid panel.
    I need a 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;
            }
    And I also called it on 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">
                                            <Renderer  Fn="RenderColor" Format="Round" FormatArgs="2" />
                                          
                                            <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">
                                            
                                             <Renderer Format="Round" FormatArgs="2" />
                                            <Renderer Fn="RenderColor" />
                                              <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.Click image for larger version. 

Name:	capturadepantallade2012t.jpg 
Views:	107 
Size:	65.9 KB 
ID:	5253
  2. #2
    Hi,

    There was the same request.
    http://forums.ext.net/showthread.php?22561

Similar Threads

  1. [CLOSED] render window with hide.event
    By gidi in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 12, 2012, 2:44 PM
  2. Using Functions with Ext
    By VRamone in forum 1.x Help
    Replies: 8
    Last Post: Apr 05, 2012, 12:05 PM
  3. Replies: 2
    Last Post: Sep 10, 2011, 8:01 AM
  4. [CLOSED] After Render Event for Slider
    By danielg in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 13, 2010, 5:52 PM
  5. grid render event listener
    By [WP]joju in forum 1.x Help
    Replies: 1
    Last Post: Nov 05, 2009, 1:42 AM

Tags for this Thread

Posting Permissions