[CLOSED] GridPanel selected focus

  1. #1

    [CLOSED] GridPanel selected focus



    Hi,
    we are using coolite version 0.8.

    I want select only one row in grid. This is i can, but I'm selecting a row in grid and clicked the button then i have changed the selectedindex of grid, but previous selectedindex is only selected in grid. How can i solve this.In version 0.7 it's working perfectly.

    sample code is following

    in checkbox selection i have write following code
    <ext:GridPanel ID="GrdPnl1" StoreID="Sto1" runat="server" StripeRows="true" Border="true" TrackMouseOver="true" MaskDisabled="false" >
    <ColumnModel ID="ColumnModel2" runat="server" >
    <Columns> </Columns>
    <AjaxEvents> 
    <HiddenChange ShowWarningOnFailure="false" Timeout="120000" OnEvent="ColumnHiddenChange"> 
    <ExtraParams> 
    <ext:Parameter Name="index" Value="columnIndex" Mode="Raw" />
    <ext:Parameter Name="hidden" Value="hidden" Mode="Raw" /> 
    </ExtraParams> 
    </HiddenChange> 
    </AjaxEvents>
    </ColumnModel > 
    <SelectionModel>
    <ext:CheckboxSelectionModel HideCheckAll="true" SingleSelect="true" ID="CheckboxSelectionModel1" 
    runat="server" >
    <Listeners> 
    <RowDeselect Handler="Tab2disable();" ></RowDeselect> 
    <RowSelect Handler="if(Ext.isEmpty(record.data.sys_id, false) &amp;&amp; Ext.isEmpty(record.data.order_no, false)){return false;}" />
    </Listeners>
    <AjaxEvents> 
    <RowSelect OnEvent="SubmitSelection" ShowWarningOnFailure="false" Timeout="120000" Success="window.Tab2enable();" > 
    <ExtraParams> 
    <ext:Parameter Name="Values" Value="Ext.encode(#{GrdPnl1}.getRowsValues(true))" Mode="Raw" />
    </ExtraParams>
    </RowSelect>
    </AjaxEvents>
    </ext:CheckboxSelectionModel>
    </SelectionModel>
    <Plugins>
    <ext:GridPanelMaintainScrollPositionOnRefresh ID="GridPanelMaintainScrollPositionOnRefresh1" runat="server"></ext:GridPanelMaintainScrollPositionOnRefresh>
    <ext:GridFilters runat="server" ID="GridFilters1" Local="true">
    <Filters></Filters>
    </ext:GridFilters>
    </Plugins>
    <View>
    <ext:GridView ID="GridView1" runat="server">
    <Listeners>
    <BeforeRefresh Handler="#{GrdPnl1}.bwrap.mask('Refreshing...','x-mask-loading');" />
    <Refresh Handler="#{GrdPnl1}.bwrap.unmask();" />
    </Listeners>
    </ext:GridView>
    </View>
    <BottomBar>
    <ext:PagingToolBar ID="PagingToolBar1" runat="server" StoreID="Sto1" DisplayInfo="true" />
    </BottomBar>
    </ext:GridPanel>
    
    
    protected void SubmitSelection(object sender, AjaxEventArgs e)
    {
    string LStr_json = e.ExtraParams["Values"];
    string[] Lses = new string[100];
    string[] Lcno = new string[3];
    string[] Lano = new string[3];
    string[] Lsys = new string[3];
    Lses = LStr_json.Split(',');
    if (Lses.GetLength(0) >= 2)
    {
    Lsys = Lses[1].Split(':');
    Lcno = Lses[2].Split(':');
    Lano = Lses[0].Split(':');
    Lcno = Lcno[1].Split('"');
    Lano = Lano[1].Split('"');
    }
    if (Lcno[1] != "" &amp;&amp; Lcno[1]!=null)
    {
    Session["A_collection_no"] = Lcno[1];
    Session["A_article_no"] = Lano[1];
    Session["G_sys_id"] = Lsys[1];
    }
    CheckboxSelectionModel sm = this.GrdPnl1.SelectionModel.Primary as CheckboxSelectionModel;
    sm.SingleSelect = true;
    StringBuilder sb = new StringBuilder();
    foreach (SelectedRow row in sm.SelectedRows)
    { 
    string aaa = row.RowIndex.ToString();
    Session["index"] = row.RowIndex.ToString();
    }
    }
    I have changed the selectedindex value on button click event like this,

    protected void Next(object sender, AjaxEventArgs e)
    {
    Session["index"] = Convert.ToInt32(Session["index"].ToString()) + 1;
    }
    then i have clicked another button to select current selectedvalue in the grid,then code is

    protected void Button1(object sender, AjaxEventArgs e)
    {
    RowSelectionModel sm = this.GrdPnl1.SelectionModel.Primary as RowSelectionModel;
    if (Session["A_article_no"] != null)
    {
    int number_of_record = 20;
    int number = Convert.ToInt32(Convert.ToInt32(Session["index"].ToString()) / number_of_record) + 1;
    int number1 = Convert.ToInt32(Convert.ToInt32(Session["index"].ToString()) % number_of_record);
    PagingToolBar1.PageIndex = number;
    Sto1.On("load", new JFunction("this.getSelectionModel().selectRow(" + number1 + ");"), "GrdPnl1", new HandlerConfig { Single = true }); 
    sm.SelectedIndex = number1;
    }
    }
    Thanks &amp; Regards
    speedstep
  2. #2

    RE: [CLOSED] GridPanel selected focus

    Hi,

    I am not tested it but try to swap the following lines

    Example (Existing)

    PagingToolBar1.PageIndex = number;
    Sto1.On("load", new JFunction("this.getSelectionModel().selectRow(" + number1 + ");"), "GrdPnl1", new HandlerConfig { Single = true });
    Example (Revised)

    Sto1.On("load", new JFunction("this.getSelectionModel().selectRow(" + number1 + ");"), "GrdPnl1", new HandlerConfig { Single = true });
    PagingToolBar1.PageIndex = number;

Similar Threads

  1. IFrame: Gridpanel focus
    By mrd in forum 2.x Help
    Replies: 1
    Last Post: Dec 05, 2012, 3:49 AM
  2. Replies: 5
    Last Post: Sep 08, 2011, 5:57 AM
  3. Replies: 1
    Last Post: Oct 13, 2010, 11:09 PM
  4. [CLOSED] How to Focus to the Next Editor in a GridPanel Row?
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Sep 22, 2010, 9:18 PM
  5. Replies: 2
    Last Post: Dec 25, 2009, 2:56 PM

Posting Permissions