[CLOSED] Dynamic Store: undefined error at client side

  1. #1

    [CLOSED] Dynamic Store: undefined error at client side

    Hi folks,

    this piece of code ...

            private void Core_BuildStore(ComboBox o)
            {          
                JsonReader j = new JsonReader(); 
                j.Fields.Add("Key", RecordFieldType.Int);
                j.Fields.Add("Text", RecordFieldType.String);
                j.Fields.Add("ValueCode", RecordFieldType.String);
    
                Store xStore = new Store();
                xStore.ID = "Store_WDL_FICH";
                xStore.Reader.Add(j); 
                xStore.DataSource = my dynamic List<T> ; 
                xStore.DataBind();
    
                o.ValueField = "Key"; // "ValueCode";
                o.DisplayField = "Text";
                o.Store.Add(xStore);
            }
    raises error "undefined Store_WDL_FICH" at client side:

    Store_WDL_FICH.callbackRefreshHandler(response, {serviceResponse: {success:true,data:{data:[{"Key":0,"Text":"PLANTILLA AUTORIZADORES.HTML","ValueCode":"PLANTILLA AUTORIZADORES.HTML"},{"Key":1,"Text":"PLANTILLA USUARIOS.HTML","ValueCode":"PLANTILLA USUARIOS.HTML"}], total: 0}}}, Store_WDL_FICH, o.eventType, o.action, o.extraParams)
    May you help me what is wrong?

    Cheers!
    Last edited by Daniil; Nov 18, 2011 at 5:40 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Is it during a DirectEvent?

    Do you render a ComboBox?

    What exactly is the requirement?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Is it during a DirectEvent?

    Do you render a ComboBox?

    What exactly is the requirement?
    Daniil,

    This is raised from a button DirectEvent. It first calls this code and afterwards the previous one:

                   else if (typeof(C) == typeof(ComboBox))
                    {
                        ComboBox o = field as ComboBox;
                        o.FieldLabel = "WDL_FICHE;
                        o.EmptyText = "Seleccione ...";
                        o.AllowBlank = false;
                        o.IndicatorIcon = Icon.BulletRed;
                        o.IndicatorTip = "";
    
                        if (IsID == true)
                        {
                            o.Attributes.Add("onfocus", "this.blur()");
                            o.ReadOnly = true;
                        }
                        else
                        {
                                o.Attributes.Remove("onfocus");
                                o.ReadOnly = false;
                        }
    
                           Core_BuildStore(o);
                    }
                }   // else if (typeof(C) == typeof(ComboBox))
    Requeriment is dynamically build the combobox and the store (this one is an Enumerable<specific known object>

    Cheers
  4. #4
    Please look at the example.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void RenderComboBox(object sender, DirectEventArgs e)
        {
            Store store = new Store()
            {
                ID = "Store1",
                Reader =
                {
                    new ArrayReader()
                    {
                        Fields =
                        {
                            new RecordField("value"),
                            new RecordField("text")   
                        }   
                    }
                }
            };
            store.DataSource = new object[] 
                { 
                    new object[] { "1", "item1" },
                    new object[] { "2", "item2" },
                    new object[] { "3", "item3" }
                };
            store.DataBind();
    
            ComboBox c = new ComboBox();
            c.Store.Add(store);
    
            this.Form.Controls.Add(c);
    
            c.Render();
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button 
                runat="server" 
                Text="Render a ComboBox" 
                OnDirectClick="RenderComboBox" />
        </form>
    </body>
    </html>

Similar Threads

  1. Replies: 3
    Last Post: Dec 26, 2011, 1:32 PM
  2. Replies: 1
    Last Post: Jun 28, 2011, 10:38 PM
  3. Replies: 1
    Last Post: Dec 01, 2010, 5:14 PM
  4. Replies: 4
    Last Post: Mar 19, 2010, 11:35 AM
  5. Replies: 1
    Last Post: Feb 24, 2010, 3:05 PM

Posting Permissions