PDA

View Full Version : [CLOSED] Disable plugin on client side



rbtceo
Jul 17, 2014, 5:33 AM
Hi All,

Can I disable a plugin on event?

For example:


<ext:Checkbox runat="server">
<Listeners>
<Change Handler="function(item,newItem,oldItem){
if(newItem==true){
#{control2}.plugins=undefined; //???
}
}"></Change>
</Listeners>
</ext:Checkbox>


<ext:TextField runat="server" ID="control2" >
<Plugins>
<ext:InputMask runat="server" Mask="(99) 9999 9999" />
</Plugins>
</ext:TextField>

Thank you.

Daniil
Jul 17, 2014, 2:45 PM
Hi @rbtceo,

Please use this to disable:

App.control2.inputMask.disable();
and this to enable

App.control2.inputMask.enable();

As a side note, you don't need a function wrapper if you use handler.

<Change Handler="if (newValue) { App.control2.inputMask.disable(); }" />

rbtceo
Jul 17, 2014, 11:41 PM
Hi Daniil,

Thank you for your answer.

this is a page:


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="input_mask.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<div>
<ext:Checkbox runat="server">
<Listeners>
<Change Handler="function(item,newItem,oldItem){
if(newItem==true){
#{control2}.inputMask.disable();
}
else{
#{control2}.inputMask.enable();
}
}"></Change>
</Listeners>
</ext:Checkbox>


<ext:TextField runat="server" ID="control2" >
<Plugins>
<ext:InputMask runat="server" Mask="(99) 9999 9999" />
</Plugins>
</ext:TextField>
</div>
</form>
</body>
</html>


it works fine ones, then exceptions follow. Try it.

Daniil
Jul 18, 2014, 9:21 AM
I cannot reproduce.

As far as I can remember it has been already fixed in SVN. Please update.

rbtceo
Jul 20, 2014, 10:49 PM
Daniil,

Thank you.
I took the latest version from NuGet.

Could you specify your version build number?

Daniil
Jul 21, 2014, 4:56 AM
I think NuGet doesn't contain that fix. It has been fixed after v2.5.2 release. You should get Ext.NET from SVN.


Could you specify your version build number?

A build number depends on the time of actual building. So, it is not quite useful information in this case.

rbtceo
Jul 21, 2014, 6:20 AM
Thank you.