Oct 26, 2010, 2:11 PM
Using a Store from Code-Behind after DataBinding
Hi,
i want to access a Store "if its possible" via the code behind, instead of passing the ExtraParams.
ASPX
We have the .SelectedIndex of a Combobox, now with the Index to receive back the Item/Object from the Store.
Something like this, would be very powerful:
We dont want to keep extra arrays or lists only with id and value because, we straight want to stick to the Stores with our OR Mapping (Linq-to-SQL).
i want to access a Store "if its possible" via the code behind, instead of passing the ExtraParams.
ASPX
<ext:ComboBox ID="cbMonthTheme" runat="server" Editable="true" TypeAhead="true" Mode="Local"
AnchorHorizontal="100%" ForceSelection="true" TriggerAction="All" SelectOnFocus="true"
DisplayField="NAME" ValueField="ID_GUI">
<DirectEvents>
<Select OnEvent="UpdateAreaModuleSize" />
</DirectEvents>
<Store>
<ext:Store runat="server" ID="storeMonthTheme">
<Reader>
<ext:JsonReader>
<Fields>
<ext:RecordField Name="NAME" Type="String" Mapping="NAME" />
<ext:RecordField Name="ID_GUI" Type="String" Mapping="ID_GUI" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
</Store>
</ext:ComboBox>
Whats workings: .DataSource and .DataBind with LINQ then DirectEvent: <Select OnEvent="UpdateMonthTheme">
<ExtraParams>
<ext:Parameter Name="AreaModuleData" Value="#{storeAreaModule}.getAt(#{cbAreaModule}.selectedIndex).data"
Mode="Raw" Encode="true" />
</ExtraParams>
</Select>
and Deserialize it again in Code-Behind:protected void UpdateMonthTheme(object sender, DirectEventArgs e)
{
ZSD_GDA_MOD data = JSON.Deserialize<ZSD_GDA_MOD>(e.ExtraParams["AreaModuleData"]);
}
Question: What we've trying to do is instead of deserialzing to access to object in the store directly from binding again.We have the .SelectedIndex of a Combobox, now with the Index to receive back the Item/Object from the Store.
Something like this, would be very powerful:
protected void UpdateMonthTheme(object sender, DirectEventArgs e)
{
ZSD_GDA_MOD data = (ZSD_GDA_MOD)storeMonthTheme.Items[cbMonthTheme.SelectedIndex];
}
Sure this makes only sense on static select data of combo boxes, not for ajax edit/changes postbacks.We dont want to keep extra arrays or lists only with id and value because, we straight want to stick to the Stores with our OR Mapping (Linq-to-SQL).
Last edited by csharpdev; Oct 26, 2010 at 2:17 PM.