[CLOSED] [1.0] MultiCombo resets store on load

  1. #1

    [CLOSED] [1.0] MultiCombo resets store on load

    After deleting records from grid opening the dropdown list restores the grid to its first load content.

    code is below

    To replicate , load form , select and then click the delete button for a few records in the grid

    Open the dropdown.

    The grid gets restored



    ASPX
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="ComboTest2.aspx.cs" Inherits="ComboTest2" %>
    <%@ Register TagPrefix="ext" Namespace="Ext.Net" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <script type="text/javascript">
            function AddNewToDo() {
                var opRecord = grdToDoActions.insertRecord(grdToDoActions.store.data.length);
                var lpIndex = grdToDoActions.store.indexOf(opRecord);
                grdToDoActions.getView().focusRow(lpIndex);
                grdToDoActions.startEditing(lpIndex, 1);
            
            }
        
        var removeEmployee = function () {
            var grid = grdProjectUser;
                    grid.getRowEditor().stopEditing();
                    
                    var s = grid.getSelectionModel().getSelections();
                    
                    for (var i = 0, r; r = s[i]; i++) {
                       strProjectUser.remove(r);
                    }
                }
    
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Store ID="strProjectUser" runat="server">
            <Reader>
                <ext:JsonReader IDProperty="UserID">
                    <Fields>
                        <ext:RecordField Name="UserID">
                        </ext:RecordField>
                        <ext:RecordField Name="UserName">
                        </ext:RecordField>
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
        <ext:GridPanel ID="grdProjectUser" runat="server" EnableColumnHide="false" StoreID="strProjectUser"
            StripeRows="true" Title="Users" Height="300px">
            <plugins>
                    <ext:RowEditor runat="server" SaveText="Update" />
                </plugins>
            <columnmodel>
                                                            <Columns>
                                                                <ext:Column Header="User" DataIndex="UserName">
                                                                </ext:Column>
                                                            </Columns>
                                                        </columnmodel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel2" runat="server">
                </ext:RowSelectionModel>
            </SelectionModel>
            <bottombar>
                                                            <ext:PagingToolbar ID="PagingToolbar4" runat="server" PageSize="20" HideRefresh="false" />
                                                        </bottombar>
            <View>
                <ext:GridView runat="server" ID="GridView2" ForceFit="true">
                </ext:GridView>
            </View>
            <topbar>
                                                        <ext:Toolbar runat="server">
                        <Items>
                                                        <ext:Button runat="server" Text="Remove Employee" Icon="UserDelete">
                                <Listeners>
                                    <Click Fn="removeEmployee" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                                                        </topbar>
        </ext:GridPanel>
        <h2>
            Simple MultiCombo</h2>
        <ext:MultiCombo ID="Multi1" runat="server" Width="260" StoreID="strProjectUser" ValueField="UserID"
            DisplayField="UserName">
        </ext:MultiCombo>
        
        </form>
    </body>
    </html>
    Code Behind

    using System;
    using System.Collections.Generic;
    using System.Web.UI;
    public partial class ComboTest2 : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var opUserList = new List<ProjectUser>();
                for (int i = 0; i < 10; i++)
                {
                    opUserList.Add(new ProjectUser {UserID = i, UserName = string.Format("User {0}", i)});
                }
                strProjectUser.DataSource = opUserList;
                strProjectUser.DataBind();
            }
        }
    }
    public class ProjectUser
    {
        public int UserID { get; set; }
        public string UserName { get; set; }
    }
  2. #2
    Hello, danielg!

    Thanks for the clear sample code that we can test locally without any formatting, changing, removing, adding. It's rare.

    I've got the issue too. But it happens only for the first test, right?
    And the issue doesn't appear when the dropdown is opened earlier than grid items are deleted...

    I'll try work it out...
  3. #3
    Hi,

    Please set Mode="Local" for the Combo
  4. #4
    Thanks - that worked.

    Dan

Similar Threads

  1. Replies: 1
    Last Post: Feb 17, 2012, 7:22 AM
  2. Replies: 13
    Last Post: Nov 10, 2011, 1:26 PM
  3. Multicombo store proxy
    By David Pelaez in forum 1.x Help
    Replies: 1
    Last Post: Feb 08, 2011, 1:27 PM
  4. [CLOSED] ComboBox value resets after typeAhead does not return a match
    By joeRobee in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Jan 06, 2011, 2:54 PM
  5. [CLOSED] [1.0] MultiCombo with Store
    By danielg in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 13, 2010, 12:47 PM

Posting Permissions