PDA

View Full Version : [CLOSED] Hidden="true" behaves as Visible="false"



marco.morreale
May 25, 2012, 10:14 AM
I'm trying to hide a ComoboBox when it has just one record.

I need the form layout is mantained; so I expect the control leaves white space at his place.
But the control disappears freeing space and other controls moves.

This is "Visible= false" behavioor not "hidden=true"

My ComboBox is inside a FieldContainer with Layout="HBoxLayout"

Here is my Combo. Please note in Store Listener.

M




<ext:ComboBox ID="cbCilindro" runat="server" Editable="false" ForceSelection="true" ValueField="Code" DisplayField="Cilindro" Flex="1"
Note="Cilindro" NoteAlign="Top" SelectOnFocus="true" Margins="0 8 0 0" >
<ListConfig>
<ResizableConfig runat="server" Handles="South" />
</ListConfig>
<Store>
<ext:Store ID="stCilindro" runat="server" PageSize="10">
<Proxy>
<ext:AjaxProxy Json="true" Url="../WebServices/AjaxWebService.asmx/getCilindroProdotto">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader Root="d.Data" TotalProperty="d.Total" />
</Reader>
</ext:AjaxProxy>
</Proxy>
<Parameters>
<ext:StoreParameter Name="basketID" Value='<%# Request.QueryString["Id"] %>' AutoDataBind="true" />
<ext:StoreParameter Name="gruppoMerc" Value="#{cbFamiglieProdotto}.getValue()" Mode="Raw" />
<ext:StoreParameter Name="confezione" Value="#{cbConfezioniProdotto}.getValue()" Mode="Raw" />
<ext:StoreParameter Name="campione" Value="false" Mode="Value" />
</Parameters>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Code" />
<ext:ModelField Name="Cilindro" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Load Handler="if (records.length==1) { #{cbCilindro}.hide(); }" />
</Listeners>
<%--<Sorters>
<ext:DataSorter Property="Cilindro" Direction="ASC" />
</Sorters>--%>
</ext:Store>
</Store>
<Listeners>
<Select Handler="#{cbAsse}.clearValue();#{stAsse}.load();" />
</Listeners>
</ext:ComboBox>

Daniil
May 25, 2012, 10:32 AM
Hi,

I would try with

HideMode="Visibility"

Example

<%@ Page Language="C#" %>

<%@ 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>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:FormPanel runat="server">
<Items>
<ext:TextField runat="server" FieldLabel="TextField" />
<ext:ComboBox
ID="ComboBox1"
runat="server"
FieldLabel="ComboBox"
HideMode="Visibility" />
<ext:TextField runat="server" FieldLabel="TextField" />
</Items>
</ext:FormPanel>

<ext:Button runat="server" Text="Hide ComboBox">
<Listeners>
<Click Handler="App.ComboBox1.hide();" />
</Listeners>
</ext:Button>
</form>
</body>
</html>

marco.morreale
May 25, 2012, 10:41 AM
The problem persists.
I tried every option of the HideMode attribute.



<ext:ComboBox ID="cbCilindro" runat="server" Editable="false" ForceSelection="true" ValueField="Code" DisplayField="Cilindro" Flex="1"
Note="Cilindro" NoteAlign="Top" SelectOnFocus="true" Margins="0 8 0 0" HideMode="Visibility" >

Daniil
May 25, 2012, 11:01 AM
But it appears to be working in the example above. So, please provide your full test case.

marco.morreale
May 28, 2012, 8:31 AM
To reproduce the errore I just added the Layout="HBoxLayout" attribute.



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestExtNet.aspx.cs" Inherits="renosistemi.it.TestExtNet" %>
<%@ 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>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:FormPanel runat="server" Layout="HBoxLayout">
<Items>
<ext:TextField runat="server" FieldLabel="TextField" />
<ext:ComboBox ID="ComboBox1" runat="server" FieldLabel="ComboBox" HideMode="Visibility" />
<ext:TextField runat="server" FieldLabel="TextField" />
</Items>
</ext:FormPanel>
<ext:Button runat="server" Text="Hide ComboBox">
<Listeners>
<Click Handler="App.ComboBox1.hide();" />
</Listeners>
</ext:Button>
</form>
</body>
</html>

Daniil
May 28, 2012, 3:17 PM
I can suggest the following solution.

Example

<%@ Page Language="C#" %>

<%@ 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>Ext.NET v2 Example</title>
</head>
<body>
<ext:ResourceManager runat="server" />

<ext:FormPanel runat="server" Height="25" Layout="HBoxLayout">
<Items>
<ext:TextField runat="server" Width="200" FieldLabel="TextField" />
<ext:Container runat="server" Width="200" Layout="AnchorLayout">
<Items>
<ext:ComboBox
ID="ComboBox1"
runat="server"
FieldLabel="ComboBox"
AnchorHorizontal="100%" />
</Items>
</ext:Container>
<ext:TextField runat="server" Width="200" FieldLabel="TextField" />
</Items>
</ext:FormPanel>

<ext:Button runat="server" Text="Hide ComboBox">
<Listeners>
<Click Handler="App.ComboBox1.hide();" />
</Listeners>
</ext:Button>

<ext:Button runat="server" Text="Show ComboBox">
<Listeners>
<Click Handler="App.ComboBox1.show();" />
</Listeners>
</ext:Button>
</body>
</html>