[CLOSED] How Can I to use the property AlwaysMergeItems?

  1. #1

    [CLOSED] How Can I to use the property AlwaysMergeItems?

    Hi, How Can I to use the property AlwaysMergeItems in a ComboBox, I want an example please, because I don't understand this property.

    Regards
    Last edited by Daniil; Mar 28, 2014 at 9:36 PM. Reason: [CLOSED]
  2. #2
    Hi @osef,

    A developer can load the items to a ComboBox via its Items or Store. In some scenarios it might be needed to combine Items and Store. Though, I would not recommend to do that.

    AlwaysMergeItems="true" (by default) means that on each Store Load event, the Store's data is merged with the Items. AlwaysMergeItems="false" means that they are merged on the first load only.

    Please look at this example.

    1. Expand the ComboBox
    2. You can see all the items.
    3. Click the Reload Button.
    4. Expand the ComboBox.
    5. You can use that the "Some ListItem" has gone.

    Then please try the same with AlwaysMergeItems="true".

    Generally speaking, it is a very specific functionality and it is very unlike you'll need to use it ever.

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Store_ReadData(object sender, StoreReadDataEventArgs e)
        {
            Store store = sender as Store;
            store.DataSource = new object[] 
            { 
                new object[] { "1", "Item 1" },
                new object[] { "2", "Item 2" },
                new object[] { "3", "Item 3" }
            };
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:ComboBox
                ID="ComboBox1"
                runat="server"
                DisplayField="text"
                ValueField="value"
                AlwaysMergeItems="false">
                <Store>
                    <ext:Store runat="server" OnReadData="Store_ReadData" AutoLoad="false">
                        <Proxy>
                            <ext:PageProxy>
                                <Reader>
                                    <ext:ArrayReader />
                                </Reader>
                            </ext:PageProxy>
                        </Proxy>
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="value" />
                                    <ext:ModelField Name="text" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <Items>
                    <ext:ListItem Text="Some ListItem" />
                </Items>
            </ext:ComboBox>
    
            <ext:Button runat="server" Text="Reload" Handler="App.ComboBox1.store.reload();" />
        </form>
    </body>
    </html>
  3. #3
    Thank you Daniil.

Similar Threads

  1. Replies: 6
    Last Post: Feb 24, 2014, 10:48 AM
  2. Tag Property
    By camazorro in forum 1.x Help
    Replies: 2
    Last Post: Apr 04, 2012, 10:35 PM
  3. Replies: 3
    Last Post: Dec 15, 2011, 12:18 PM
  4. Replies: 1
    Last Post: Feb 22, 2011, 11:25 PM
  5. [CLOSED] how to set panel html property as javascript property
    By kenanhancer in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Jan 05, 2011, 6:45 PM

Tags for this Thread

Posting Permissions