[CLOSED] Formpanel read-only

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Formpanel read-only

    you can disable all controls of a formpanel?
    Or should I turn them off one at a time?
    Last edited by Daniil; Oct 08, 2010 at 3:49 PM. Reason: [CLOSED]
  2. #2
    Hi,

    There is no such method in the FormPanel.

    I would suggest you to use cascade method.

    For example, a code disabling all TextFields within a FromPanel can look something like this:

    var myFunction = function() {
        if (this.getXType() == 'textfield') {
            this.setDisabled(true);
        }
    }
    
    FormPanel1.cascade(myFunction);
  3. #3
    only works if the javascript function is declared in the page.
    but if I declare an external file

    <!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 id="Head1" runat="server">
    <title>GridPanel with Form Details - Ext.NET Examples</title>
     
    
    <script type="text/javascript" src="Js/JScript.js"></script>
    
    </head>
    <body>
    <form id="Form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    getXType() is undefined....


    how can I use ExtJS functions in a js file outside?
  4. #4
    Please try the following thing.

    Example
    <ext:ResourcePlaceHolder runat="server" />
    <script type="text/javascript" src="Js/JScript.js"></script>
  5. #5
    unfortunately still does not work.

     
    <%@ 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 id="Head1" runat="server">
    <title>GridPanel with Form Details - Ext.NET Examples</title>
    <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
    <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script" /> 
    <script type="text/javascript" src="Js/JScript.js"></script>
    </head>
  6. #6
    Can I look at the code that causes js error?

    Posting .aspx page reproducing the issue would be the best.
  7. #7
    the problem is on call.
    The call without parameters it works.
    The call parameters does not work.

    syntax:

    FormPanel1.cascade (Disabilita2 (true));

    is correct?

    Page.aspx


    <%@ Page Language="C#" AutoEventWireup="true"  %>
    
    <%@ 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 id="Head1" runat="server">
        <title>GridPanel with Form Details - Ext.NET Examples</title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="Script"  /> 
        <script type="text/javascript" src="Js/JScript.js"></script>
        
        
        
        
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />     
                    
                
            <ext:Viewport ID="Viewport1" runat="server" Layout="border">
                <Items>
                
                 
                  
                    <ext:FormPanel 
                        ID="FormPanel1" 
                        runat="server" 
                        Region="Center"
                        Split="true"
                        Margins="0 5 5 5"
                        Frame="true" 
                        Title="Dettaglio Flotta" 
                        Width="280"
                        Icon="Folder"
                        DefaultAnchor="100%">
                        <Items>
                        
                         <ext:Button ID="Button1" runat="server" Text="Call Disabilita1(work)">
                    <Listeners>
                        <Click Handler="FormPanel1.cascade(Disabilita);" />
                    </Listeners>
                </ext:Button>
                
                   <ext:Button ID="Button2" runat="server" Text="Call Disabilita2(does not work)">
                    <Listeners>
                        <Click Handler="FormPanel1.cascade(Disabilita2(true));" />
                    </Listeners>
                </ext:Button>
                    
                        
                            <ext:TextField ID="TextFieldNome" runat="server" FieldLabel="Nome" DataIndex="Name" Disabled="true" />
                            <ext:TextField ID="TextFieldDescription" runat="server" FieldLabel="Descrizione" DataIndex="Description" Height="50" />
                            <ext:TextField ID="TextFieldOwner" runat="server" FieldLabel="Owner" DataIndex="Owner" />
                        </Items>
                    </ext:FormPanel>
                </Items>
            </ext:Viewport>
        </form>
    </body>
    </html>
    JScript.js

    var Disabilita = function() {
        if (this.getXType() == 'textfield') {
            this.setDisabled(true);
        }
    }
    
    var Disabilita2 = function(disable) {
        if (this.getXType() == 'textfield') {
            this.setDisabled(disable);
        }
    }
  8. #8
    Hi,

    With arguments it should look like this:
    <Click Handler="FormPanel1.cascade(Disabilita2, false, [true]);" />
    See also:
    http://dev.sencha.com/deploy/dev/doc...member=cascade
  9. #9
    is absurd!!!

     
    FormPanel1.cascade(Abilita, false, [true]); ///work!!!
    
    FormPanel1.cascade(Abilita, true, [true]); ///not work
    whi????
  10. #10
    cascade( Function fn, [Object scope], [Array args] ) : Ext.Container
    Cascades down the component/container heirarchy from this component (called first), calling the specified function with each component. The scope (this) of function call will be the scope provided or the current component. The arguments to the function will be the args provided or the current component. If the function returns false at any point, the cascade is stopped on that branch.

    Parameters:

    • fn : FunctionThe function to call
    • scope : Object(optional) The scope of the function (defaults to current component)
    • args : Array(optional) The args to call the function with (defaults to passing the current component)

    Returns:
    • Ext.Container

    this


    If you pass true as the second parameter then there is
    true.getXType() ...
    within the function.

    Does the "true" object have this method? No, it doesn't.

    If you pass false then the scope of function will be a current component because of
    cascade : function(fn, scope, args){
            if(fn.apply(scope || this, args || [this]) !== false){
                ...
    (false || this) will be this.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: Nov 17, 2011, 10:53 AM
  2. [CLOSED] Read Only NumberField
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 04, 2010, 6:25 PM
  3. [CLOSED] [1.0] TriggerField read-only
    By danielg in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 04, 2009, 10:15 AM
  4. [CLOSED] Read GridPanelRows
    By GmServizi in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 03, 2009, 12:40 PM

Posting Permissions