[CLOSED] rowexpander for specific rows

  1. #1

    [CLOSED] rowexpander for specific rows

    hello guys, am looking for you help to hide expand button from the record have value "ahmed" in its Employee coulmn.
    Is it possible !

        <ext:FormPanel ID="fpSubjects" IDMode="Static" runat="server" Title="subjects" Width="500" AutoHeight="true">
                <Items> 
                <ext:Panel ID="pSubjects" IDMode="Static" runat="server" >
                <Items>
                   <ext:TableLayout ID="tl1" IDMode="Static" runat="server" Columns="1">
                        <Cells> 
                            <ext:Cell>
               <ext:GridPanel ID="gpSubjects" IDMode="Static" runat="server" AutoHeight="true" Width="500"
                Title="offering" Collapsed="false" Collapsible="true" > 
                <Store>
                    <ext:Store ID="Store1" runat="server">
                        <Reader> 
                            <ext:ArrayReader>
                                <Fields>
                                    <ext:RecordField Name="employee_ID"></ext:RecordField>
                                    <ext:RecordField Name="employee_firstName"></ext:RecordField>
                                    <ext:RecordField Name="employee_secondName"></ext:RecordField>
                                </Fields>
                            </ext:ArrayReader>
                        </Reader>
                    </ext:Store>
                </Store>
                    <ColumnModel>
                        <Columns> 
                            <ext:RowNumbererColumn Header="#"></ext:RowNumbererColumn> 
                            <ext:Column Header="Employee ID"  ColumnID="clEmployeeID" DataIndex="employee_ID" Width="60">
                            </ext:Column> 
                            <ext:Column Header="Employee Name" ColumnID="clEmployeeName" DataIndex="employee_Name" Width="60"> 
                            </ext:Column> 
                        </Columns>
                    </ColumnModel> 
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel2" runat="server" SingleSelect="true" />
                    </SelectionModel> 
                    <Plugins>
                        <ext:RowExpander ID="RowExpander" runat="server"> 
                            <Component>
                                <ext:FormPanel ID="RowEditorRegistration" runat="server" Padding="6" AutoHeight="true" Width="400"
                                    Border="false" Layout="form" ForceLayout="true" ButtonAlign="Right" Cls="white-footer">
                                    <Items>
                                            <ext:GridPanel ID="gpOfferingElectiveSubjects" IDMode="Static" runat="server" AutoHeight="true" Width="300"  
                                            Title="Elective" Collapsed="false" Collapsible="true"  >
                                            <Store>
                                                <ext:Store ID="Store2" runat="server">
                                                    <Reader> 
                                                        <ext:ArrayReader>
                                                            <Fields>
                                                                <ext:RecordField Name="employee_ID"></ext:RecordField>
                                                                <ext:RecordField Name="employee_firstName"></ext:RecordField>
                                                                <ext:RecordField Name="employee_secondName"></ext:RecordField>
                                                            </Fields>
                                                        </ext:ArrayReader>
                                                    </Reader>
                                                </ext:Store>
                                            </Store>
                                            <ColumnModel>
                                                <Columns>  
                                                    <ext:RowNumbererColumn Header="#"></ext:RowNumbererColumn> 
                                                    <ext:Column Header="Employee ID"  ColumnID="clEmployeeID" DataIndex="employee_ID" Width="100">
                                                    </ext:Column> 
                                                    <ext:Column Header="Employee Name" ColumnID="clEmployeeName" DataIndex="employee_Name" Width="100"> 
                                                    </ext:Column> 
                                                </Columns>
                                            </ColumnModel>  
                                            <SelectionModel>
                                                <ext:RowSelectionModel ID="RowSelectionModel6" LazyMode="Instance" runat="server" SingleSelect="true" />
                                            </SelectionModel> 
                                        </ext:GridPanel> 
                                    </Items> 
                                </ext:FormPanel>
                            </Component>   
                            <Listeners>
                                <Expand Handler="Ext.fly(body).swallowEvent(['click', 'mousedown', 'mouseup', 'dblclick'], true);" />
                            </Listeners>    
                        </ext:RowExpander>
                        
                                        
                    </Plugins>  
                </ext:GridPanel>
                </ext:Cell>
                </Cells>
                </ext:TableLayout>
                </Items>
                </ext:Panel>
                </Items>
                </ext:FormPanel>
    Last edited by Daniil; Mar 21, 2012 at 8:26 AM. Reason: [CLOSED]
  2. #2
  3. #3
    Quote Originally Posted by Daniil View Post
    i have a look on that before and dont get anything. As you see i put gridPanel inside the RowExpander in static mode and dont wanna change it for server mode.
    is it possible to do that here !
  4. #4
    As you see i put gridPanel inside the RowExpander in static mode and dont wanna change it for server mode.
    It doesn't matter, the main thing to achieve your requirement is:

    Quote Originally Posted by Daniil View Post
    2. Added this thing
    <script type="text/javascript">
        Ext.grid.RowExpander.override({
            renderer: function(v, p, record) {
                if (record.get('Number') % 2 == 0) {
                    p.cellAttr = 'rowspan="2"';
                    return '<div class="x-grid3-row-expander"> </div>';
                }
                return '';
            }
        });
    </script>
    Just change the renderer function according to your requirement:
    hide expand button from the record have value "ahmed" in its Employee coulmn
  5. #5
    Quote Originally Posted by Daniil View Post
    It doesn't matter, the main thing to achieve your requirement is:



    Just change the renderer function according to your requirement:

    Dear Daniil am so thankful it is work somehow good.

    it seems like it hide the expander button but its functionality still work on row double click. I
    added this part of code on render of main grid and it seems not bad.

    <script type="text/javascript">
    var expandRow = function (sender, record) { 
                     if (record.get('employee_ID') == "Ahmed") { 
                         RowEditorRegistration.collapse();
                     }
                     else {
                         RowEditorRegistration.expand();
                     } 
    
     }
    </script>
  6. #6
    Quote Originally Posted by imaa View Post
    it seems like it hide the expander button but its functionality still work on row double click.
    Please return false from a RowExpander BeforeExpand listener for such rows.
  7. #7
    Quote Originally Posted by Daniil View Post
    Please return false from a RowExpander BeforeExpand listener for such rows.
    ThanQ man it is awesome.

    When i start looking for expander i notice there is "caching" on the Gridpanel in dynamic example ! from where i can
    get info about that !

Similar Threads

  1. [CLOSED] GridPanel.Rows.Changing Background Color of Rows
    By supera in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 01, 2012, 5:18 PM
  2. [CLOSED] RowExpander throwing error while expand inner rows initially
    By rnachman in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: May 31, 2011, 11:23 PM
  3. Replies: 1
    Last Post: Oct 13, 2010, 11:09 PM
  4. Replies: 3
    Last Post: Jul 07, 2010, 1:28 AM
  5. [CLOSED] XRender insert in specific index
    By jchau in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 02, 2010, 7:05 PM

Posting Permissions