[CLOSED] Multi Selector throws exception while removinig last item

  1. #1

    [CLOSED] Multi Selector throws exception while removinig last item

    Hi,

    We implemented MultiSelector in our application and found some exception. Refer the code:

    <%@ Page Language="C#" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                this.BindData();
            }
        }
    
        private void BindData()
        {
            string[] firstNames = new string[] { "Russel", "Clark", "Steve", "Sam", "Lance", "Robert", "Sean", "David", "Justin", "Nicolas", "Brent" };
            string[] lastNames = new string[] { "Wood", "Lewis", "Scott", "Parker", "Ross", "Garcia", "Bell", "Kelly", "Powell", "Moore", "Cook" };
    
            var data = new List<object>();
            var rand = 37;
            int k;
            int id = 0;
    
            for (int i = 0; i < lastNames.Length; ++i)
            {
                var map = new Dictionary<string, int>();
    
                var s = firstNames[i];
    
                data.Add(new
                {
                    ID = ++id,
                    Forename = s,
                    Surname = lastNames[i]
                });
    
                map[s] = 1;
    
                for (int j = 0; j < 3; ++j)
                {
                    do
                    {
                        k = rand % firstNames.Length;
                        rand = rand * 1664525 + 1013904223; // basic LCG but repeatable
                        rand &= 0x7FFFFFFF;
                        s = firstNames[k];
                    } while (map.ContainsKey(s));
    
                    map[s] = 1;
                    data.Add(new
                    {
                        ID = ++id,
                        Forename = s,
                        Surname = lastNames[i]
                    });
                }
            }
    
            this.Store1.DataSource = data;        
            this.Store2.DataSource = data.GetRange(1, 3);        
        }
    
        protected void OnClick(object sender, DirectEventArgs e)
        {
            var values = Selector1.Values;
    
            if (values != null && values.Keys.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
    
                foreach (var empl in values)
                {
                    sb.Append(empl.Value).Append("<br/>");
                }
    
                X.Msg.Alert("Selected employess", sb.ToString()).Show();
            }
            else
            {
                X.Msg.Alert("Selected employess", "No employees").Show();
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>MultiSelector - Ext.NET Examples</title>
        <link href="/resources/css/examples.css" rel="stylesheet" />
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
            <h1>MultiSelector</h1>
    
            <ext:Model ID="Model1" runat="server" Name="Employee" IDProperty="ID">
                <Fields>
                    <ext:ModelField Name="ID" />
                    <ext:ModelField Name="Forename" />
                    <ext:ModelField Name="Surname" />
                    <ext:ModelField Name="Name">
                        <Convert Handler="return record.get('Forename') + ' ' + record.get('Surname'); " />
                    </ext:ModelField>
                </Fields>
            </ext:Model>
    
            <ext:MultiSelector
                runat="server"
                ID="Selector1"
                Width="400"
                Height="300"
                Title="Selected Employees"
                FieldName="Name">
                <Store>
                    <ext:Store ID="Store2" runat="server" ModelName="Employee" ShowWarningOnFailure="false" />
                </Store>
                <ViewConfig DeferEmptyText="false" EmptyText="No employees selected" />
                <Search>
                    <ext:MultiSelectorSearch ID="MultiSelectorSearch1" runat="server" Field="Name">
                        <SearchGridConfig ID="SearchGridConfig1" runat="server" BufferedRenderer="false" />
                        <Store>
                            <ext:Store ID="Store1" runat="server" ModelName="Employee" ShowWarningOnFailure="false">
                                <Sorters>
                                    <ext:DataSorter Property="Name" />
                                </Sorters>
                            </ext:Store>
                        </Store>
                    </ext:MultiSelectorSearch>
                </Search>
    
                <Buttons>
                    <ext:Button ID="Button1" runat="server" Text="Show value" OnDirectClick="OnClick" />
                </Buttons>
            </ext:MultiSelector>
        </form>
    </body>
    </html>
    Steps:

    1) Remove the records in Multiselector one by one.
    2) On removal of last record from the control, an exception is occurs as mentioned in the attached screenshot.

    Please verify and revert back.
    Attached Thumbnails Click image for larger version. 

Name:	Multi.jpg 
Views:	6 
Size:	56.7 KB 
ID:	21321  
    Last edited by Daniil; Feb 19, 2015 at 4:34 AM. Reason: [CLOSED]
  2. #2
    Hello @speedstepmem4,

    Thank you for the report! Probably, it has been fixed already since I cannot reproduce it with the latest Ext.NET from SVN trunk.
  3. #3

    Multi Selector throws exception while removinig last item

    Thank you for your prompt response, but we wonder why this is not working (or updated) in your examples explorer!




    Examples not working as expected:
    https://examples3.ext.net/#/Miscellane..._Cell_Tooltip/
    https://examples3.ext.net/#/Form/Misce...MultiSelector/


    We refer Ext.Net in our application through Nuget. Please confirm the latest build is updated in NuGet as we are not able to see Ext.Net in
    updates section of Visual Studio NuGet Package Manager Console.



    Please confirm us!!!
    Last edited by speedstepmem4; Feb 19, 2015 at 4:15 AM. Reason: Nuget reference asked
  4. #4

Similar Threads

  1. Item Selector >> RTL
    By elie in forum 2.x Help
    Replies: 0
    Last Post: Feb 17, 2015, 5:15 PM
  2. Replies: 7
    Last Post: Jan 20, 2015, 6:06 PM
  3. [CLOSED] Form -> Multi Selector
    By mohan.bizbites in forum 3.x Legacy Premium Help
    Replies: 6
    Last Post: Dec 04, 2014, 3:06 PM
  4. [CLOSED] Item Selector
    By CanopiusApplications in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 25, 2014, 4:44 PM
  5. Paging and Sorting Example throws exception
    By Skorfulose in forum 1.x Help
    Replies: 1
    Last Post: Nov 19, 2009, 3:30 AM

Posting Permissions