[CLOSED] How to get custom config parameters into JS function?

Page 1 of 3 123 LastLast
  1. #1

    [CLOSED] How to get custom config parameters into JS function?

    Hello

    I call on a window creation this code :

                                    <Listeners>
                                        <Show Fn="showChartBacklog()">
                                           <CustomConfig >
                                                <ext:ConfigItem Name="Chart" Value=this.ID Mode="Raw" ></ext:ConfigItem   >
                                            </CustomConfig>
                                        </Show>
                                    </Listeners>
    Question : into
    showChartBacklog
    function, how I get Chart parameter?
    Last edited by Daniil; Dec 14, 2012 at 4:37 AM. Reason: [CLOSED]
  2. #2
    Hi @feanor,

    This way:

    Example
    var showChartBacklog = function (/* all the arguments here*/ eOpts) {
        console.log(eOpts.Chart);
    };
  3. #3
    OK, thanks
  4. #4
    Why don't you want to pass required arguments directly to fn?
    <Show Handler="showChartBacklog(this.id);">
    Last edited by Vladimir; Dec 13, 2012 at 1:33 PM.
  5. #5
    Bacause I had problem and I think it was related to that parameters.

    I have to explain:

    I do that:


    Show Fn="showChartBacklog("wndChart")"
    It works on dev side, but not when I run from IIS server, I have a message : "showChartBacklog didn't exists" . I think it was about the parameter send mode, but in fact no, In showChartBacklog function I define a variable like that :

    Var Height;
    and later in code I do something like that:

    Height=300;
    To make it works on the production server (IIS 5) I have to define var like that:

    Var Height=0;
    If you know why...Just for personnal culture.
  6. #6
    Does it really work for you?
    Show Fn="showChartBacklog("wndChart")"
    I think there should be a parser error here.
  7. #7
    Quote Originally Posted by Daniil View Post
    Does it really work for you?
    Show Fn="showChartBacklog("wndChart")"
    I think there should be a parser error here.
    Yes it works, even with more parameters

    but wrote like that:

    Show Fn="showChartBacklog('wndChart')"
  8. #8
    Yes, there is no a parser error with single quotes, but a function is executed when a page is just loaded.

    I think a Click listener should not be executed without actual clicking. What do you think?

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>  
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            var onClick = function () {
                alert("onClick");
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:Button runat="server" Text="Test">
                <Listeners>
                    <Click Fn="onClick('test')" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    Generally, Fn expects a function name Fn="onClick" or a full definition
    Fn="function () { alert('Hello!'); }"
    If you need just some JavaScript code, then you should use Handler instead of Fn.
    <Click Handler="onClick('test');" />
  9. #9
    I'm affraid to not understanding your point here? What do you mean?
  10. #10
    There are several points in my post:) Could you clarify what exactly to clarify?
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 2
    Last Post: Jan 09, 2012, 7:18 AM
  2. Replies: 1
    Last Post: Sep 28, 2011, 3:50 AM
  3. Replies: 4
    Last Post: May 31, 2011, 11:54 AM
  4. [CLOSED] Custom config for Coolite controls
    By thaianhduc in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 10, 2010, 7:11 AM
  5. Custom function in User Controls
    By pearl in forum 1.x Help
    Replies: 2
    Last Post: Apr 08, 2009, 12:56 AM

Posting Permissions