Using a Store from Code-Behind after DataBinding

  1. #1

    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
                
    <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.
  2. #2
    Hi,

    There is no collection like Items on server side.

    For more information about the reasons please read this post:
    http://forums.ext.net/showthread.php...ll=1#post43229

Similar Threads

  1. Replies: 0
    Last Post: Oct 25, 2011, 10:02 AM
  2. Replies: 3
    Last Post: Jul 24, 2011, 1:57 PM
  3. Replies: 0
    Last Post: Jun 21, 2011, 2:51 AM
  4. [CLOSED] store always databinding in latest version
    By alexp in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 07, 2009, 4:29 PM
  5. DataBinding GridPanel/Store/Reader
    By nuno_Santos in forum 1.x Help
    Replies: 4
    Last Post: Apr 01, 2009, 2:18 PM

Tags for this Thread

Posting Permissions