you can disable all controls of a formpanel?
Or should I turn them off one at a time?
Printable View
you can disable all controls of a formpanel?
Or should I turn them off one at a time?
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:
Code:var myFunction = function() {
if (this.getXType() == 'textfield') {
this.setDisabled(true);
}
}
FormPanel1.cascade(myFunction);
only works if the javascript function is declared in the page.
but if I declare an external file
getXType() is undefined....Code:<!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" />
how can I use ExtJS functions in a js file outside?
Please try the following thing.
Example
Code:<ext:ResourcePlaceHolder runat="server" />
<script type="text/javascript" src="Js/JScript.js"></script>
unfortunately still does not work.
Code:
<%@ 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>
Can I look at the code that causes js error?
Posting .aspx page reproducing the issue would be the best.
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
JScript.jsCode:<%@ 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>
Code:var Disabilita = function() {
if (this.getXType() == 'textfield') {
this.setDisabled(true);
}
}
var Disabilita2 = function(disable) {
if (this.getXType() == 'textfield') {
this.setDisabled(disable);
}
}
Hi,
With arguments it should look like this:
See also:Code:<Click Handler="FormPanel1.cascade(Disabilita2, false, [true]);" />
http://dev.sencha.com/deploy/dev/doc...member=cascade
is absurd!!!
whi????Code:
FormPanel1.cascade(Abilita, false, [true]); ///work!!!
FormPanel1.cascade(Abilita, true, [true]); ///not work
If you pass true as the second parameter then there isQuote:
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
within the function.Code:true.getXType() ...
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
(false || this) will be this.Code:cascade : function(fn, scope, args){
if(fn.apply(scope || this, args || [this]) !== false){
...