[CLOSED] GridPanel: Problem with Selecting First Row after loading (DirectEvent timing issue)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] GridPanel: Problem with Selecting First Row after loading (DirectEvent timing issue)

    I have a Grid inside a Window (winTrendingPreferredList) which is initially Hidden=true. When a button is clicked, this window will be shown.

    My goal is that when a button is clicked, it will go to code behind via DirectMethod, which will construct the grid (and the store with it), then show the window. Once shown, I want to select and highlight the first row.

    I attached the Event in the grid's AfterLayout but it seems that the grid is empty when this is invoked, which causes an error. Can you advice which is the last event that will be triggered?

    Click image for larger version. 

Name:	image03.jpg 
Views:	181 
Size:	48.9 KB 
ID:	3306Click image for larger version. 

Name:	Image01.jpg 
Views:	156 
Size:	74.9 KB 
ID:	3307Click image for larger version. 

Name:	image02.jpg 
Views:	148 
Size:	63.9 KB 
ID:	3308

    Javascript
    var TPLManager_FirstLoad = function(){
      alert('FirstLoad');
      var grid = Ext.getCmp('GridPanel1');
      grid.getSelectionModel().selectRow(1);
      grid.getView().focusRow(1);
    }
    <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">
        </ext:RowSelectionModel>
      </SelectionModel>
      <Listeners>
        <AfterLayout Handler="if(#{winTrendingPreferredList}.hidden == false) TPLManager_FirstLoad();" />
      </Listeners>
    </ext:GridPanel>
    Regards, J
    Last edited by Daniil; Oct 06, 2011 at 8:02 AM. Reason: [CLOSED]

Similar Threads

  1. Replies: 1
    Last Post: Sep 13, 2012, 7:52 AM
  2. GridPanel Data loading problem
    By hmily6033 in forum 2.x Help
    Replies: 1
    Last Post: Jun 18, 2012, 11:24 PM
  3. Replies: 2
    Last Post: Mar 15, 2012, 6:04 AM
  4. [CLOSED] Problem with selecting values in gridpanel.
    By tlfdesarrollo in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 16, 2012, 1:38 PM
  5. [CLOSED] Performance issue with selecting 200 rows in GridPanel
    By jchau in forum 1.x Legacy Premium Help
    Replies: 16
    Last Post: Sep 24, 2009, 2:39 AM

Posting Permissions