PDA

View Full Version : [CLOSED] V2.0 ComboBox Editable



Aurelio
Feb 23, 2012, 2:22 AM
Hi, i have a problem with a combox editable, i have 2 Store, the first content the Continents and the second the Nations, load the store and in a grid panel show the Nations with GroupingSummary from Continets, in the formPanel when click on the gridpanel load the nation e the combo show the continent of the nation correctly.
Now execute this actions:

1) Select "Italia" from the grid panel
2)Click in the combobox and type "Eu", it's show "Europa"
3)Select "Cina" from the GridPanel, the combobox not show "Asia" but show "Select a state"

He seems to have applied a filter on the combobox for "Europa"

Now execute this actions:
1)Open the dropdown combobox and close.
2)Select from GridPanel "Italia" and reselect "Cina"

it's work the combobox show "ASIA"..

In the 1.2 it's work fine, the problem is only the type in the combobox, se not type but select the line with the mouse, it works fine.

Here it the code for the sample:



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

<%@ 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>Ext.NET v2 Example</title>

</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>
<ext:Store ID="Store1" runat="server">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="ConId" />
<ext:ModelField Name="ConCod" />
<ext:ModelField Name="ConDes" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:Store ID="Store2" runat="server" GroupField="ConDes">
<Model>
<ext:Model ID="Model2" runat="server">
<Fields>
<ext:ModelField Name="ConId" />
<ext:ModelField Name="ConDes" />
<ext:ModelField Name="NazId" />
<ext:ModelField Name="NazCod" />
<ext:ModelField Name="NazDes" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
<ext:Viewport ID="Viewport1" runat="server" Layout="border">
<Items>
<ext:Panel ID="PanelNazioni" runat="server" Region="West" Width="300" BodyPadding="3"
Layout="FitLayout" >
<Items>
<ext:GridPanel ID="GridPanelNazioni" runat="server" Title="Nazioni"
StoreID="Store2" >
<ColumnModel>
<Columns>
<ext:Column runat="server" ID="NazCod" DataIndex="NazCod" Align="Left" Text="Codice" Width="100" />
<ext:Column runat="server" ID="NazDes" DataIndex="NazDes" Align="Left" Flex="1" Text="Nazione" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:RowSelectionModel ID="RowSelectionModelNazione" Mode="Single" runat="server">
<Listeners>
<Select Handler="enableButtonRowSelect(record);" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<View>
<ext:GridView ID="GridViewNazioni" runat="server" StripeRows="true" MarkDirty="false" />
</View>
<Features>
<ext:GroupingSummary ID="GroupingSummaryContinenti" runat="server" GroupHeaderTpl='{name} ({[values.rows.length]} {[values.rows.length > 1 ? "Nazioni":"Nazione"]})'>
</ext:GroupingSummary>
</Features>
</ext:GridPanel>
</Items>
</ext:Panel>
<ext:FormPanel ID="FormPanelNazione" runat="server" ButtonAlign="Right" Height="185"
BodyPadding="10" Padding="3" Region="Center" Title="Nazioni...">
<FieldDefaults LabelWidth="70" />
<FieldDefaults ReadOnly="false" />
<Items>
<ext:ComboBox ID="ComboBoxContinenti"
runat="server"
StoreID="Store1"
Editable="true"
DisplayField="ConDes"
ValueField="ConId"
TypeAhead="true"
QueryMode="Local"
ForceSelection="true"
EmptyText="Select a state..."
SelectOnFocus="true" ReadOnly="false">
</ext:ComboBox>
<ext:TextField ID="txtNazCod" runat="server" Width="180" AllowBlank="false"
BlankText="*Obbligatorio" MaxLength="4" MaxLengthText="*Lunghezza massima 4 caratteri."
FieldLabel="Codice" Name="NazCod" FieldCls="txtObbligatorio">
<ToolTips>
<ext:ToolTip ID="ToolTipNazCod" runat="server" Title="Codice" Html="Codice della nazione">
</ext:ToolTip>
</ToolTips>
</ext:TextField>
<ext:TextField ID="txtNazDes" runat="server" AnchorHorizontal="100%" AllowBlank="false"
BlankText="*Obbligatoria" MaxLength="50" MaxLengthText="*Lunghezza massima 50 caratteri."
FieldLabel="Nazione" Name="NazDes" FieldCls="txtObbligatorio">
<ToolTips>
<ext:ToolTip ID="ToolTipNazDes" runat="server" Title="Continente" Html="Descrizione dela nazione" />
</ToolTips>
</ext:TextField>

</Items>

</ext:FormPanel>
</Items>
</ext:Viewport>
<script type="text/javascript">


//Carica il record dalla griglia nella form e abilita i button.
function enableButtonRowSelect(record) {

if (record != null) {
App.FormPanelNazione.getForm().loadRecord(record);
App.FormPanelNazione.setTitle(record.data["NazDes"]);
App.ComboBoxContinenti.setValue(record.data["ConId"]);
};
};



</script>
</form>

</body>
</html>




protected void Page_Load(object sender, EventArgs e)
{
Store1.DataSource = new object[]
{
new object[] { "1", "Eu", "Europa" },
new object[] { "2", "As", "Asia" }
};
Store1.DataBind();

Store2.DataSource = new object[]
{
new object[] { "1","Europa","1","IT", "Italia" },
new object[] { "2","Asia" ,"2", "CN", "Cina" }
};

}




Tanks

Aurelio

Daniil
Feb 23, 2012, 7:39 AM
Hi @Aurelio,

Yes, there is the default functionality in Ext.NET v2 to filter ComboBox items on user input.

To fix please clear filter before applying a value:

App.ComboBoxContinenti.getStore().clearFilter();
App.ComboBoxContinenti.setValue(record.data["ConId"]);

Aurelio
Feb 23, 2012, 11:37 AM
Hi Daniil
Tanks work OK..

Aurelio