[CLOSED] GridPanel remove +/- in Group and prevent collapse all together?

  1. #1

    [CLOSED] GridPanel remove +/- in Group and prevent collapse all together?

    How can I hide the + and - button in GridPanel grouping? And prevent collapse of group all together?
    Last edited by Daniil; Jan 24, 2014 at 3:46 AM. Reason: [CLOSED]
  2. #2
    Hi @rthiney,

    1. The <style> section turns off the "-" images.
    2. The GridPanel's ViewReady listener turns off collapsing on click.

    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.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "group1", "1", "1" },
                    new object[] { "group1", "11", "11" },
                    new object[] { "group1", "111", "111" },
                    new object[] { "group2", "2", "2" },
                    new object[] { "group2", "22", "22" },
                    new object[] { "group2", "222", "222" }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <style>
            .my-grid .x-grid-group-hd-collapsible .x-grid-group-title {
                background-image: none;
            }
        </style>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server" Cls="my-grid">
                <Store>
                    <ext:Store runat="server" GroupField="groupId">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="groupId" />
                                    <ext:ModelField Name="test1" />
                                    <ext:ModelField Name="test2" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="GroupId" DataIndex="groupId" />
                        <ext:Column runat="server" Text="Test1" DataIndex="test1" />
                        <ext:Column runat="server" Text="Test2" DataIndex="test2" />
                    </Columns>
                </ColumnModel>
                <Features>
                    <ext:Grouping runat="server" />
                </Features>
                <Listeners>
                    <ViewReady Handler="var g = this.getFeature('grouping'); 
                                        this.getView().un('groupclick', g.onGroupClick, g);" />
                </Listeners>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  3. #3

    Update for Ext.Net 3.1.2

    Hello all,

    - minor nitpick: in Ext.Net.3.1.2 at line #64 above var g = this.getFeature('grouping'); returns that .getFeature is undefined.

    - replacing with var g = this.features[0]; seems to work fine.
    - NOTE: This code assumes that the Grouping feature is at the first position in the Grid's Features collection.

    hth,
    AnFil
  4. #4
    Thank you for the update, @AnFil!

    Also this.getFeature('grouping') could be replaced with this.groupingFeature.

Similar Threads

  1. Replies: 3
    Last Post: Sep 30, 2013, 4:01 AM
  2. Replies: 2
    Last Post: Dec 13, 2012, 4:43 AM
  3. [CLOSED] prevent timefield to collapse
    By zwf in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 22, 2012, 12:37 PM
  4. prevent group expand on row select
    By wp_joju in forum 1.x Help
    Replies: 3
    Last Post: Jan 10, 2011, 1:11 PM
  5. grid grouping prevent collapse
    By [WP]joju in forum 1.x Help
    Replies: 4
    Last Post: Jan 18, 2010, 1:03 AM

Posting Permissions