Store can't be found

  1. #1

    Store can't be found

    My project gives me an error when i'm trying to render a name instead of the ID from Store1.

    It's on the client side I get the error. ( 'Store2' is not defined )

    The specific column :
     
    
    
    <ext:Column Width="180" Header="LeverandÝr" DataIndex="SupplierId" Hidden="false">
    
    
    <Renderer Fn="MyFunction" />
    
    
    </ext:Column>
    Store2 :
    
    
    
    
    
    <asp:SqlDataSource ID="LeverandoerDS" runat="server" ConnectionString="<%$ ConnectionStrings:Ordresystem %>"SelectCommand="SELECT * FROM [Suppliers] ORDER BY [Name]"></asp:SqlDataSource>
    <ext:Store ID="Store2" runat="server" AutoLoad="true">
    <Reader>
    <ext:JsonReader ReaderID="SupplierId">
    <Fields>
    <ext:RecordField Name="SupplierId" />
    <ext:RecordField Name="Name" />
    </Fields>
    </ext:JsonReader>
    </Reader>
    </ext:Store>
    Javascript :
    <script type="text/javascript">
    var MyFunction = function(value) {
    var r = Store2.getById(value);
    if (Ext.isEmpty(r)) {
    return "";
    }
    return r.data.Name;
    }
    </script>
    How do i solve this problem ? Have been trying differetn things such as binding the data in pageload but with no success.

  2. #2

    RE: Store can't be found

    Hi ulrikn,

    Please ensure the id Store2 is the client-side ID of the Store and not the server-side ID. You can get the client-side ID by using the .ClientID property.


    I suspect you are using a MasterPage template which by default will change the ID of any Control placed within to ensure they are unique.


    You can render the .ClientID property of the Store inline using the following syntax, or just hardcode the value.


    Example


    var r = <%= this.Store2.ClientID %>.getById(value);

    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: Store can't be found

    Thanks Geoffrey

    Exactly what I needed - works perfectly :)

Similar Threads

  1. [CLOSED] The control with ID 'ext-empty-store' not found
    By supera in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 31, 2012, 12:16 PM
  2. Store not Found
    By camazorro in forum 1.x Help
    Replies: 1
    Last Post: Jan 17, 2012, 6:47 AM
  3. [1.0] File ext.net.dll not found
    By walle in forum 1.x Help
    Replies: 4
    Last Post: Nov 05, 2010, 11:07 PM
  4. Label1 is can't found HELP!
    By iscript in forum 1.x Help
    Replies: 2
    Last Post: Apr 10, 2009, 4:39 AM
  5. Replies: 3
    Last Post: Nov 03, 2008, 1:35 PM

Posting Permissions