[CLOSED] Gridpanel refresh in button directevent

  1. #1

    [CLOSED] Gridpanel refresh in button directevent

    I need to refresh the gridpanel store from a button directevent. I cannot get the result.

    I put also a label in the page, and the label text gets refreshed in the directevent, but the gridpanel doesnt.

    This is the code:
        <form runat="server">
               <ext:ResourceManager ID="rm01" runat="server" />
               <ext:Panel 
                        ID="pnl1"
                        runat="server" 
                        Title="Prueba" 
                        Frame="true"
                        Width="600" >
                    <Items>
                        <ext:Panel 
                        ID="pnl2" Flex="1" 
                        runat="server" 
                        Title="ID" 
                        Frame="true" DefaultButton="btnNSS"
                        Width="180" ButtonAlign="Left">
                            <Items>
                                <ext:TextField ID="txtNSS" runat="server" Note="99-99-99-9999 (10 digitos)" MaxLengthText="13">
                                    <Plugins>
                                        <ext:InputMask runat="server" Mask="99-99-99-9999" />
                                    </Plugins>
                                </ext:TextField>
                                <ext:Label ID="lbl01" runat="server" Text="some" />
                            </Items>
                            <Buttons>
                                    <ext:Button ID="btnNSS" runat="server" Text="Buscar" Icon="Accept"  Cls="default" >
                                        <Listeners>
                                            <Click Handler="
                                                if (!#{txtNSS}.validate()) {
                                                    Ext.Msg.alert('Error','NSS es requerido');
                                                    return false; 
                                                }
                                                " />
                                        </Listeners>
                                        <DirectEvents>
                                            <Click OnEvent="btnNSSClick">
                                                <EventMask ShowMask="true" Msg="Buscando..." MinDelay="500" />
                                            </Click>
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:Button ID="btnL" runat="server" Text="Limpiar" Icon="PageWhite"  Cls="default" >
                                        <Listeners>
                                            <Click Handler="#{gpnl2}.getStore().removeAll();" />
                                        </Listeners>
                                    </ext:Button>
                            </Buttons>
                        </ext:Panel>
                        <ext:GridPanel 
                            ID="gpnl2" 
                            runat="server"
                            Title="Informacion" 
                            Width="595" AutoScroll="true"
                            Height="300">
                            <Store>
                                <ext:Store ID="st01" runat="server" autoload="false">
                                    <Model>
                                        <ext:Model runat="server">
                                            <Fields>
                                                <ext:ModelField  Name="A" />
                                                <ext:ModelField  Name="B" />
                                                <ext:ModelField  Name="C" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel runat="server">
                                <Columns>
                                    <ext:Column runat="server" Text="A" DataIndex="A" Locked="true" Width="30"/>
                                    <ext:Column runat="server" Text="B" DataIndex="B" Width="80" Locked="true"/>
                                    <ext:Column runat="server" Text="C" DataIndex="C/>
                                </Columns>
                            </ColumnModel>        
                        </ext:GridPanel>
                </Items>
            </ext:Panel>
        </form>
    This is the codebehind:
            protected void btnNSSClick(object sender, DirectEventArgs e)
            {
                if (txtNSS.Text.Length == 13)                
                {
                    string _nss = txtNSS.Text.Substring(0, 2) + txtNSS.Text.Substring(3, 2) + txtNSS.Text.Substring(6, 2) + txtNSS.Text.Substring(9);
                    try
                    {
                        int _iTotal = 0;
                        wsConsVigGpoFamComXNssService _ws = new wsConsVigGpoFamComXNssService();
                        gpnl2.Store.Primary.DataSource = _ws.NssInfoFull(_nss, Constant.wsConsVigGpoFamComXNssVigenciomatico, out _iTotal);
                        gpnl2.Store.Primary.DataBind();  //I see the datasource and it contains the rows, but it is not refreshing
    
                       //I also used this:
                       //st01.DataSource = _ws.NssInfoFull(_nss, Constant.wsConsVigGpoFamComXNssVigenciomatico, out _iTotal);
                       //st01.DataBind();  
    
    
                        lbl01.Text = _iTotal.ToString();  //This value is refreshing ok
    
                        if (_iTotal == 0)
                        {
                            X.Msg.Show(new MessageBoxConfig
                            {
                                Message = "NSS["+ txtNSS.Text + "] NO Encontrado.",
                                Title = "Informe",
                                Icon = Ext.Net.MessageBox.Icon.ERROR,
                                Buttons = MessageBox.Button.OK
                            });
                        }
                    }
                    catch
                    {
                    }
                }
            }
    I'm using a generic List for populating the DataSource:
        public class ABC 
        {
            public string A;
            public string B;
            public string C;
        }
            public List<ABC> NssInfoFull(string Nss, string AppId, out int Total)
            {
                Total = 0;
                List<ABC> _lABC = new List<ABC>();
    
                 ABC _abc = new ABC();
                _abc.A = "1";
                _abc.B = "1";
                _abc.C = "1";
    
                _lABC.Add(_abc);
    
                return _lABC;
            }
    Some similar like this post:
    http://forums.ext.net/showthread.php...el-databinding

    Thanks for your help.
    Last edited by Daniil; May 04, 2015 at 9:54 PM. Reason: [CLOSED]
  2. #2

    Getter & Setter

    It works just adding the get & set to the class definition:

    public class ABC 
        {
            public string A {get; set;};
            public string B {get; set;};
            public string C {get; set;};
        }

Similar Threads

  1. Replies: 1
    Last Post: Apr 04, 2014, 5:56 PM
  2. Replies: 9
    Last Post: Feb 22, 2014, 5:02 AM
  3. Replies: 0
    Last Post: Jun 13, 2009, 5:34 AM
  4. Replies: 2
    Last Post: Apr 22, 2009, 7:44 AM
  5. GridPanel Refresh button
    By Dgsoft.ru in forum 1.x Help
    Replies: 1
    Last Post: Apr 09, 2009, 4:41 PM

Tags for this Thread

Posting Permissions