[CLOSED] Extra Check Boxes when adding header to grouped Grid with CheckBoxSelectionMode

  1. #1

    [CLOSED] Extra Check Boxes when adding header to grouped Grid with CheckBoxSelectionMode

    See attached image.
    Adding header in code behind.

    GridPanel definition
    
    <ext:GridPanel runat="server" ID="gridPort" AutoHeight="true" AutoWidth="true">
        <Store>
            <ext:Store ID="storePort" runat="server" GroupField="Sector" GroupDir="ASC">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="CondorPortfolioId" Type="Int">
                            </ext:RecordField>
                            <ext:RecordField Name="Id" Type="Int">
                            </ext:RecordField>
                            <ext:RecordField Name="Name" Type="String">
                            </ext:RecordField>
                            <ext:RecordField Name="Weight" Type="Float">
                                <Convert Handler="return value * 100;" />
                            </ext:RecordField>
                            <ext:RecordField Name="Sector" Type="String">
                            </ext:RecordField>
                            <ext:RecordField Name="Strategy" Type="String">
                            </ext:RecordField>
                            <ext:RecordField Name="PortfolioExposureLong" Type="Float" > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="PortfolioExposureShort" Type="Float"  > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="EquityExposureLong" Type="Float"  > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="EquityExposureShort" Type="Float"  > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="CreditExposureLong" Type="Float" > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="CreditExposureShort" Type="Float" > <Convert Handler="return value * 100;" /></ext:RecordField>
                      <ext:RecordField Name="OtherExposureLong" Type="Float"  > <Convert Handler="return value * 100;" /></ext:RecordField>
                        <ext:RecordField Name="OtherExposureShort" Type="Float" > <Convert Handler="return value * 100;" /></ext:RecordField>
                      
                        </Fields>
                    </ext:JsonReader>
                </Reader>
                <SortInfo Field="Strategy" Direction="ASC" />
            </ext:Store>
        </Store>
        <ColumnModel>
            <Columns>
                <ext:Column ColumnID="Sector" DataIndex="Sector" Header="Sector" Width="150">
                </ext:Column>
                <ext:Column ColumnID="Strategy" DataIndex="Strategy" Header="Strategy" Width="150"
                    Groupable="false">
                </ext:Column>
                <ext:GroupingSummaryColumn ColumnID="Name" DataIndex="Name" Header="Name" Width="300"
                    SummaryType="Count" Groupable="false">
                    <SummaryRenderer Handler="return   (value > 1) ? value +  ' Holdings' : value + ' Holding' " />
                </ext:GroupingSummaryColumn>
                <ext:GroupingSummaryColumn ColumnID="Weight" DataIndex="Weight" Header="Weight (%)"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="70">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
    
          <ext:GroupingSummaryColumn ColumnID="PortfolioExposureLong" DataIndex="PortfolioExposureLong" Header="Long %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
            <ext:GroupingSummaryColumn ColumnID="PortfolioExposureShort" DataIndex="PortfolioExposureShort" Header="Short %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
                               
    
          <ext:GroupingSummaryColumn ColumnID="EquityExposureLong" DataIndex="EquityExposureLong" Header="Long %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
            <ext:GroupingSummaryColumn ColumnID="EquityExposureShort" DataIndex="EquityExposureShort" Header="Short %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
                               
    
    
          <ext:GroupingSummaryColumn ColumnID="CreditExposureLong" DataIndex="CreditExposureLong" Header="Long %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
            <ext:GroupingSummaryColumn ColumnID="CreditExposureShort" DataIndex="CreditExposureShort" Header="Short %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
                               
    
    
          <ext:GroupingSummaryColumn ColumnID="OtherExposureLong" DataIndex="OtherExposureLong" Header="Long %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
            <ext:GroupingSummaryColumn ColumnID="OtherExposureShort" DataIndex="OtherExposureShort" Header="Short %"
                    Align="Center" SummaryType="Sum" Groupable="false" Width="65">
                    <Renderer Fn="RenderReturnAmount" />
                    <SummaryRenderer Handler="return Ext.util.Format.round(value,2) + ' %';" />
                </ext:GroupingSummaryColumn>
    
    
                <ext:CommandColumn Hidden="true">
                    <GroupCommands>
                        <ext:CommandFill />
                        <ext:GridCommand Icon="TableRow" CommandName="SelectGroup">
                            <ToolTip Title="Select All" Text="Select all rows of the group" />
                        </ext:GridCommand>
                    </GroupCommands>
                </ext:CommandColumn>
            </Columns>
        </ColumnModel>
        <LoadMask ShowMask="true" />
        <SaveMask ShowMask="true" />
        <Listeners>
            <GroupCommand Handler="this.getSelectionModel().selectRecords(records, true); return;   " />
        </Listeners>
        <View>
            <ext:GroupingView ID="GroupingView1" runat="server" GroupTextTpl="{gvalue}" EmptyText="There are currently zero holdings in this portfolio."
                EnableNoGroups="True">
            </ext:GroupingView>
        </View>
        <Plugins>
            <ext:GroupingSummary ID="GroupingSummary1" runat="server">
            </ext:GroupingSummary>
            <ext:GridFilters ID="GridFilters1" runat="server">
                <Filters>
                    <ext:StringFilter DataIndex="Name" />
                </Filters>
            </ext:GridFilters>
        </Plugins>
        <SelectionModel>
            <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" RowSpan="1"
                CheckOnly="true">
                <Listeners>
                    <RowSelect Handler="UpdateSelectedIds(record.data.Id,true);" />
                    <RowDeselect Handler="UpdateSelectedIds(record.data.Id,false);" />
                </Listeners>
            </ext:CheckboxSelectionModel>
        </SelectionModel>
    </ext:GridPanel>
    Code Behind that is adding header
       //add group headers
                var view = this.gridPort.View[0];
                var headerRow = new HeaderGroupRow();
    
                headerRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = "",
                    Align = Alignment.Center,
                    ColSpan = 5,
                    
                });
                headerRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = "Total",
                    Align = Alignment.Center,
                    ColSpan = 2
                });
                headerRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = "Equity",
                    Align = Alignment.Center,
                    ColSpan = 2
                });
                headerRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = "Credit",
                    Align = Alignment.Center,
                    ColSpan = 2
                });
                headerRow.Columns.Add(new HeaderGroupColumn
                {
                    Header = "Other",
                    Align = Alignment.Center,
                    ColSpan = 2
                });
                view.HeaderGroupRows.Add(headerRow);
    Attached Thumbnails Click image for larger version. 

Name:	Capture.PNG 
Views:	163 
Size:	8.3 KB 
ID:	1636  
    Last edited by Daniil; Sep 23, 2010 at 7:18 AM. Reason: [CLOSED]
  2. #2
    Hi rthiney,

    Thank you for the report.
    We are investigating.

    Here is a minimized code sample.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.Store.Primary;
                store.DataSource = new object[] { 
                                             new object[] {"test1"},
                                             new object[] {"test2"},
                                             new object[] {"test3"},
                                    };
                store.DataBind();
            }
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:GridPanel ID="GridPanel1" runat="server" AutoHeight="true">
            <Store>
                <ext:Store runat="server">
                    <Reader>
                        <ext:ArrayReader>
                            <Fields>
                                <ext:RecordField Name="test" />
                            </Fields>
                        </ext:ArrayReader>
                    </Reader>
                </ext:Store>
            </Store>
            <ColumnModel runat="server">
                <Columns>
                    <ext:Column Header="Test" DataIndex="test" />
                </Columns>
            </ColumnModel>
            <View>
                <ext:GridView>
                    <HeaderGroupRows>
                        <ext:HeaderGroupRow>
                            <Columns>
                                <ext:HeaderGroupColumn ColSpan="1"/>
                            </Columns>
                        </ext:HeaderGroupRow>
                    </HeaderGroupRows>
                </ext:GridView>
            </View>
            <SelectionModel>
                <ext:CheckboxSelectionModel runat="server" />
            </SelectionModel>
        </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3
    Hi,

    Fixed in SVN. Please update
  4. #4
    [CLOSED]
    Works like a charm. Thanks.

Similar Threads

  1. [CLOSED] Adding extra listitem at top combobox
    By CarWise in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jun 29, 2012, 10:57 AM
  2. [CLOSED] Tree Panel: Multiple selection with check boxes
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 16, 2011, 2:07 PM
  3. [CLOSED] Hiding check boxes in some groups in Grid
    By imaa in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 20, 2011, 12:55 PM
  4. Exclusive Check Boxes
    By juredecman in forum 1.x Help
    Replies: 0
    Last Post: Aug 31, 2010, 11:40 PM
  5. Replies: 2
    Last Post: Mar 21, 2010, 1:18 PM

Posting Permissions