How to get client reference on Store

Page 3 of 4 FirstFirst 1234 LastLast
  1. #21
    Where is the store in your real project? .asxp page, master page, content page, user control?
  2. #22
    On the project where I need to use this it is Content page.
    On the example I test this it is simple .aspx page.

    I both cases I have the same result.
  3. #23
    Quote Originally Posted by boris View Post
    On the project where I need to use this it is Content page.
    MasterPage/ContentPage changes the Store's ClientID.

    Possible solutions:

    1. IDMode="Explicit" for the Store.

    2. <ext:XScript> plus #{} syntax.

    Example
    <ext:XScript runat="server">
        <script type="text/javascript">
            var onClick = function () {
                alert(#{Store1});
            }
        </script>
    </ext:XScript>
    Please place it within the <head>.

    Quote Originally Posted by boris View Post
    On the example I test this it is simple .aspx page.
    Did you test exactly the page I posted?
  4. #24
    1. IDMode="Explicit" for the Store.
    dis don't work

    but this:
    2. <ext:XScript> plus #{} syntax.
    Works ! It works on clear aspx page and on the content page. (I know that Master/Content changes the ID, bat object is found. How, I don't know.)


    Did you test exactly the page I posted?
    Yes. I only change this:
    var onClick function () {
                var store = Ext.StoreMgr.get("Store1");
                alert(store);
            }
    to this:

            var onClick = function () {
                var store = Ext.StoreMgr.get("Store1");
                alert(store);
            }
    difference is only in "onClick ="

    Thank you! I am going to test this more ...
  5. #25
    Quote Originally Posted by boris View Post
    dis don't work
    1. IDMode="Explicit" for the Store.
    If you can, please provide a sample to reproduce.

    Quote Originally Posted by boris View Post
    Yes. I only change this:
    var onClick function () {
                var store = Ext.StoreMgr.get("Store1");
                alert(store);
            }
    to this:

            var onClick = function () {
                var store = Ext.StoreMgr.get("Store1");
                alert(store);
            }
    difference is only in "onClick ="
    Yes, I missed '=' when reformatted the code.
  6. #26
    I put the wrong code here and delete it, just wait to change ...
  7. #27
    This is with IDMode="Explicit" that don't works:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test_ExtStore._Default" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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></title>
        
            <script type="text/javascript">
                var onClick = function() {
                    var store = Ext.StoreMgr.get("Store1");
                    alert(store);
                }
            </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
            <ext:Store ID="Store1" runat="server" IDMode="Explicit">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="Polje_1">
                            </ext:RecordField>
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
         
            <ext:Button ID="Button1" runat="server" Text="Click me">
                <Listeners>
                    <Click Handler="onClick()" />
                </Listeners>
            </ext:Button>  
        
        </div>
        </form>
    </body>
    </html>
  8. #28
    Quote Originally Posted by boris View Post
    This is with IDMode="Explicit" that don't works:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Test_ExtStore._Default" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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></title>
        
            <script type="text/javascript">
                var onClick = function() {
                    var store = Ext.StoreMgr.get("Store1");
                    alert(store);
                }
            </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
            <ext:Store ID="Store1" runat="server" IDMode="Explicit">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="Polje_1">
                            </ext:RecordField>
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
         
            <ext:Button ID="Button1" runat="server" Text="Click me">
                <Listeners>
                    <Click Handler="onClick()" />
                </Listeners>
            </ext:Button>  
        
        </div>
        </form>
    </body>
    </html>
    Alert box shows me the object, nit undefined.
  9. #29
    at me shows 'undefined'

    Maybe something need to instal, or add some libraties from Sencha ... ?
  10. #30
    No sources form Sencha are required. They are in Ext.Net.

    There was the related to StoreMgr and Stores fix.

    I believe it should be ok on your side as well when you'll try it with Ext.Net RC2 which will be released soon.
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Render dynamic store id in client different when postback
    By Nhím Hổ Báo in forum 1.x Help
    Replies: 1
    Last Post: May 03, 2012, 8:50 PM
  2. Replies: 10
    Last Post: Apr 20, 2012, 12:34 PM
  3. [CLOSED] assign collection to store on the client
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 23, 2010, 6:46 PM
  4. Can Store.DateSource send sub object to client?
    By firebank in forum 1.x Help
    Replies: 2
    Last Post: Apr 15, 2010, 11:48 AM
  5. Coolite Client Library Reference
    By niceguymattx in forum 1.x Help
    Replies: 1
    Last Post: Mar 10, 2010, 6:00 AM

Tags for this Thread

Posting Permissions