Pass all rows from GridPanel that have certain value in a specific column

  1. #1

    Pass all rows from GridPanel that have certain value in a specific column

    I have a Ext GridPanel named sampleGrid, which has some column. one of them is named IsAssigned holding a bool value.

    I have a ext button. when i click to it i want to pass all the row that has IsAssigned column value false.

    i can pass all the grid rows, See below code sample,
    <ext:Button ID="btnSave" runat="server" Text="Save"
                                    Icon="Accept">
                                    <DirectEvents>
                                        <Click OnEvent="btnSave_Click">
                                        <ExtraParams>
                                        <ext:Parameter Name="rows" Value="Ext.encode(#{sampleGrid}.getRowsValues())"
                                         Mode="Raw" ></ext:Parameter>
                                        </ExtraParams>
                                        </Click>
                                    </DirectEvents>
                                </ext:Button>
    Here Ext.encode(#{sampleGrid}.getRowsValues()) will pass all the rows. but i want to pass only rows that has IsAssigned column value false.

    isAssigned collum code:
    <ext:CheckColumn ColumnID="chkSelect" DataIndex="IsAssigned" MenuDisabled="true"
                                                Sortable="true" Width="30px" Editable="true">
                                            </ext:CheckColumn>
    Any Help will be appreciated.
    Last edited by rezoan; Feb 19, 2014 at 10:01 AM.
  2. #2
    define somewhere following function

    function findCustom(grid){
        var result = [];
        var store = grid.store;
        for(var i=0;i<store.getCount();i++){
    
            if(store.getAt(i).get('IsAssigned'))
                  result.push(store.getAt(i).data)
        }
        return result
    
    }
    and modify parameter
     <ext:Parameter Name="rows" Value="Ext.encode(findCustom(#{sampleGrid}))"   Mode="Raw" ></ext:Parameter>
  3. #3
    Thanks Zdenek for the reply its helpful but returns only the true columns row. but i want the false column rows

    By the way i have solved this using filterRecord,

    <ext:Parameter Name="rows" Value="Ext.encode(#{sampleGrid}.getRowsValues(
                                        {
                                        filterRecord : function (record) {
                                        return (record.data.IsAssigned==false); }
                                        })
                                        )" Mode="Raw" ></ext:Parameter>
    Again thanks for the reply. :)

Similar Threads

  1. Replies: 0
    Last Post: Feb 28, 2012, 2:15 PM
  2. Replies: 4
    Last Post: Oct 07, 2011, 9:50 AM
  3. Replies: 2
    Last Post: Nov 26, 2010, 6:30 PM
  4. Replies: 3
    Last Post: Jul 07, 2010, 1:28 AM
  5. Show Specific Column in GridPanel
    By sachin.munot in forum 1.x Help
    Replies: 3
    Last Post: Oct 22, 2009, 4:51 AM

Tags for this Thread

Posting Permissions