May 25, 2017, 4:02 AM
[CLOSED] on demand loads
Support,
I am trying to load two combos (separately). I want to load the stores when i first click the dropdown. Each click will load the store via an ajaxproxy and then expand the combo.
I find the first one works well, but the second one opens and then closes.
I tried to build an example but i dont have an external ajax proxy to use. The example is the best i can do for the forum. just replace the models with ajax proxy loads.
Thanks,
/Z
I am trying to load two combos (separately). I want to load the stores when i first click the dropdown. Each click will load the store via an ajaxproxy and then expand the combo.
I find the first one works well, but the second one opens and then closes.
I tried to build an example but i dont have an external ajax proxy to use. The example is the best i can do for the forum. just replace the models with ajax proxy loads.
Thanks,
/Z
<%@ Page Language="C#" %>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<link href="/resources/css/examples.css" rel="stylesheet" />
<style type="text/css">
.red-text {
color : red;
font-size : large;
}
</style>
<script runat="server">
protected void TestLoad(object sender, StoreReadDataEventArgs e)
{
this.Test1.Store.Primary.DataSource = new object[]
{
new object[] { 1, "test1" },
new object[] { 2, "test2" },
new object[] { 3, "test3" }
};
this.Test1.Store.Primary.DataBind();
}
protected void TestLoad2(object sender, StoreReadDataEventArgs e)
{
this.ComboBox1.Store.Primary.DataSource = new object[]
{
new object[] { 4, "test4" },
new object[] { 5, "test5" },
new object[] { 6, "test6" }
};
this.ComboBox1.Store.Primary.DataBind();
}
</script>
<script>
var runMe = function () {
App.TESTSETET.show();
};
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
<Listeners>
<DocumentReady Handler="runMe()" />
</Listeners>
</ext:ResourceManager>
<ext:Window
ID="TESTSETET"
runat="server"
Icon="ApplicationFormAdd"
Width="500"
Hidden="true"
Modal="true"
Layout="FitLayout"
Title="TEST">
<Items>
<ext:FormPanel
ID="FormTEST"
runat="server"
Layout="VBoxLayout"
BodyPadding="5"
>
<Items>
<ext:ComboBox ID="Test1"
runat="server"
DisplayField="description"
HideLabel="true"
ValueField="id"
QueryMode="Local"
EmptyText="Select ...">
<Store>
<ext:Store ID="Store1" runat="server" AutoLoad="false" OnReadData="TestLoad" >
<Model>
<ext:Model ID="Model1" IDProperty="id" runat="server">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="description" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="description" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<Triggers>
<ext:FieldTrigger Icon="Clear" Qtip="Remove selected" />
</Triggers>
<ListConfig LoadingText="Loading..." />
<Listeners>
<Focus Handler="#{Store1}.load();#{Test1}.expand();" Single="true" />
<TriggerClick Handler="this.clearValue();" />
</Listeners>
</ext:ComboBox>
<ext:ComboBox ID="ComboBox1"
runat="server"
DisplayField="description"
HideLabel="true"
ValueField="id"
QueryMode="Local"
EmptyText="Select ...">
<Store>
<ext:Store ID="Store2" runat="server" AutoLoad="false" OnReadData="TestLoad2">
<Model>
<ext:Model ID="Model2" IDProperty="id" runat="server">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="description" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="description" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<Triggers>
<ext:FieldTrigger Icon="Clear" Qtip="Remove selected" />
</Triggers>
<ListConfig LoadingText="Loading..." />
<Listeners>
<Focus Handler="#{Store2}.load();#{ComboBox1}.expand();" Single="true" />
<TriggerClick Handler="this.clearValue();" />
</Listeners>
</ext:ComboBox>
</Items>
</ext:FormPanel>
</Items>
</ext:Window>
</form>
</body>
</html>
Last edited by fabricio.murta; Jun 12, 2017 at 11:15 AM.