[CLOSED] 2 functions in the render event

  1. #1

    [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

    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.
    Attached Thumbnails Click image for larger version. 

Name:	capturadepantallade2012t.jpg 
Views:	96 
Size:	65.9 KB 
ID:	5255  
    Last edited by Daniil; Dec 12, 2012 at 11:15 AM. Reason: [CLOSED]
  2. #2
    Hi @BATCCA,

    Yes, only a single Renderer is possible.

    Please remove this one:
    <Renderer Format="Round" FormatArgs="2" />
    and replace
    return value;
    with
    return Ext.util.Format.round(value, 2);
    in the RenderColor function.

Similar Threads

  1. 2 functions in the render event
    By DiegoTc in forum 1.x Help
    Replies: 1
    Last Post: Dec 12, 2012, 11:17 AM
  2. [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
  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