Please help about combo removeall function

  1. #1

    Please help about combo removeall function

    the removeall funtion for buttonchange not work,
    also tried use in code behind:

    this.Status.GetStore.RemoveAll();
    still not work

    <%@ Page Language="C#" %>
    
    <script runat="server">
    
        protected void Page_Load(object sender, EventArgs e)
        {
        }
    
        [DirectMethod]
        protected void Update(object sender, DirectEventArgs e)
        {
            this.Status.Items.Add(new Ext.Net.ListItem("Stop","S"));
            this.Status.GetStore().DataBind();
        }
    
    </script>
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v4 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:Panel
                ID="pnlPackCenter"
                runat="server"
                Layout="HBoxLayout"
                BodyPadding="5">
                <Defaults>
                    <ext:Parameter Name="margin" Value="0 5 0 0" Mode="Value" />
                </Defaults>
                <LayoutConfig>
                    <ext:HBoxLayoutConfig Align="Middle" Pack="Center" />
                </LayoutConfig>
                <Items>
                                            <ext:ComboBox
                                                ID="Status"
                                                runat="server"
                                                FieldLabel="Status"
                                                AllowBlank="false"
                                                ForceSelection="true"
                                                >
                                                <Items>
                                                    <ext:ListItem Text="New" Value="N" />
                                                </Items>
                                            </ext:ComboBox>
    
                                        <ext:Button ID="ButtonChange" runat="server" Text="Change">
                                            <DirectEvents>
                                                <Click OnEvent="Update" 
                                                       Before="#{Status}.getStore().removeAll();
                                                               #{Status}.clearValue();
                                                              "
                                                       Failure="
                                                                Ext.MessageBox.show({
                                                                title: 'Error',
                                                                msg: result.errorMessage,
                                                                buttons: Ext.MessageBox.OK,
                                                                icon: Ext.Msg.ERROR
                                                                });
                                                               " >
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Button ID="ButtonReset" runat="server" Text="Reset">
                                                <Listeners>
                                                    <Click Handler="#{Status}.getStore().removeAll();
                                                                    #{Status}.addItem('New','N');
                                                                   " >
                                                    </Click>
                                                </Listeners>
                                        </ext:Button>
                </Items>
            </ext:Panel>
        </form>
    </body>
    </html>
    Last edited by geoffrey.mcgill; Jul 21, 2016 at 1:29 AM.
  2. #2
    Solved by use after remove all option

    this.Status.InsertItem(0, "Stop", "S");
    this.Status.SelectedItems.Clear();
    this.Status.SelectedItems.Add(new Ext.Net.ListItem { Value = listvalue });
    this.Status.UpdateSelectedItems();
    The Ext JS function removeAll has one bug will cause internalId exception, so I used #{Status}.getStore().loadData([], false) and it works fine.
    Last edited by geoffrey.mcgill; Jul 21, 2016 at 1:28 AM.

Similar Threads

  1. [CLOSED] ComboBox RemoveAll
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 12, 2012, 11:29 AM
  2. [CLOSED] GridPanel removeAll
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 03, 2012, 2:53 PM
  3. [CLOSED] removeAll EditableGrid
    By SouthDeveloper in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 07, 2011, 10:07 AM
  4. Replies: 3
    Last Post: Aug 21, 2010, 5:26 AM
  5. RemoveAll selection of MultiSelect
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 2
    Last Post: Aug 09, 2009, 5:34 PM

Posting Permissions