[CLOSED] GridPanel: Can getRowValues be customized on specific Column value?

  1. #1

    [CLOSED] GridPanel: Can getRowValues be customized on specific Column value?

    Hi,

    Is it possible to select the records programatically using Ext.JS for only those records with checkbox (Column CheckColumn with DataIndex ChkBox) is true?
    something like:

    var selectedRows = gridRight.getRowsValues({selectedOnly:false});



    <ext:GridPanel ID="GridPanel1" runat="server" Cls="without-dirty" EnableHdMenu="false"
      StripeRows="false" HideHeaders="false" Height="180" ButtonAlign="Left" AutoExpandColumn="Name">
      <Store>
        <ext:Store ID="Store1" runat="server" WarningOnDirty="false" >
          <Reader>
            <ext:ArrayReader>
              <Fields>
                <ext:RecordField Name="OID" Type="Int" />
                <ext:RecordField Name="Name" Type="String" />
                <ext:RecordField Name="SharingTypeOID" Type="Int" />
                <ext:RecordField Name="TemplateName" Type="String" />
                <ext:RecordField Name="ChkBox" Type="Boolean" />
              </Fields>
            </ext:ArrayReader>
          </Reader>
        </ext:Store>
      </Store>
      <ColumnModel ID="ColumnModel1" runat="server">
        <Columns>
          <ext:Column Header="Preferred Group Name" DataIndex="Name" Resizable="false" Width="520" />
          <ext:Column Header="Template Type" DataIndex="TemplateName" Resizable="false" Width="100" />
          <ext:CheckColumn DataIndex="ChkBox" Editable="true" Resizable="false" Width="30" Sortable="false" />
        </Columns>
      </ColumnModel>
      <SelectionModel>
        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
          <Listeners>
            <RowSelect Handler="TPLManager_LoadSelectedTest();" Delay="1" />
          </Listeners>
        </ext:RowSelectionModel>
      </SelectionModel>
    </ext:GridPanel>
    Last edited by Daniil; Oct 07, 2011 at 10:03 AM. Reason: [CLOSED]
  2. #2
    I believe you can use the .getSelections() function of the SelectionModel.

    Example

    var records = GridPanel1.sm.getSelections()
    More information available in the client-side docs.

    http://dev.sencha.com/deploy/ext-3.3...=getSelections
    Geoffrey McGill
    Founder
  3. #3
    Thanks. But what I mean is that one column contains "CheckColumn" and I want to get only records that is TRUE with this column (kind of the a WHERE clause).
  4. #4
    Hi,

    Please use the "filterRecord" option.
    GridPanel1.getRowsValues({
        filterRecord : function (record) {
            return record.get("checkColumnDataIndex");    
        }
    });
    All options are below (it's from the sources).

    // config :
    //    - selectedOnly
    //    - visibleOnly
    //    - dirtyCellsOnly
    //    - dirtyRowsOnly
    //    - currentPageOnly
    //    - excludeId
    //    - filterRecord - function (record) - return false to exclude the record
    //    - filterField - function (record, fieldName, value) - return false to exclude the field for particular record
    getRowsValues : function (config)
  5. #5
    Thanks Daniil. This is useful information.

    Please close this ticket.

    Regards, J

Similar Threads

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

Posting Permissions