[CLOSED] Combobox Previous Value

  1. #1

    [CLOSED] Combobox Previous Value

    Hi, hopefully I can describe what is happening in an understandable way.

    The combobox below is tied to a web service. When the page is coming up at the start it is pre-populated with a value. So it has a value and I want a new value I click into the combobox and clear it by backspacing or highlighting and hitting the delete key. Then I trigger the search by hitting the icon on the right or pressing the down arrow key. When the results come back from the web service and a dropdown list appears, the previous value appears back in the combobox. Oddly enough I have found that it is only the first time trying to delete the value that I have the problem. Any ideas on what is going on?

    <ext:ComboBox ID="CPM" runat="server"
        DisplayField="Value" ValueField="Value"
        QueryParam="CPM"
        Width="200" Height="10"
        AllowBlank="true"
        AutoDataBind="true" AutoShow="true"
        EnableShadow="true" ForceSelection="false"
        HideTrigger="false" ItemSelector="div.search-item"
        LoadingText="Searching..." MaxLength="100"
        MinChars="0" Mode="Default"
        Selectable="true" SelectOnFocus="true"
        TriggerAction="Query"
        TriggerIcon="Search" Truncate="true"
        TypeAhead="false">
        <Store>
            <ext:Store ID="StoreCPM" runat="server" AutoLoad="false" ShowWarningOnFailure="true" >
                <Proxy>
                    <ext:HttpProxy Method="GET" Url="http://server/WebServices/data/app.asmx/SR?appKey=PRD.Cpm" />
                </Proxy>
                <Reader>
                    <ext:XmlReader Record="r">
                        <Fields>
                            <ext:RecordField Name="id" />
                            <ext:RecordField Name="Text" />
                            <ext:RecordField Name="Value" />
                        </Fields>
                    </ext:XmlReader>
                </Reader>
                <Listeners>
                    <LoadException Handler="Ext.Msg.alert('CPM - Load failed', (!Ext.isEmpty(e) && !Ext.isEmpty(e.message)) ? e.message : response.statusText);" />
                </Listeners>
                <BaseParams>
                    <ext:Parameter Name="UserId" Value="GetEmpId()" Mode="Raw" />
                    <ext:Parameter Name="DirectReports" Value="GetDirectReports()" Mode="Raw" />
                </BaseParams>
            </ext:Store>
        </Store>
        <Template ID="TemplateCPM" runat="server">
            <Html>
            <tpl for=".">
              <div class="search-item" >
                 <h3><span>{Value}</span></h3>
            </div>
           </tpl>
            </Html>
        </Template>
        <Listeners>
            <BeforeQuery Handler="delete queryEvent.combo.lastQuery;" />
        </Listeners>
    </ext:ComboBox>
    Last edited by Daniil; Apr 25, 2011 at 7:59 AM. Reason: [CLOSED]
  2. #2
    Hi,

    By default, combo allows values from the store. In your case, empty text is not contained in the store (there is no record with empty Text) therefore combo restores old value

    Try to add empty item to the combo
    <Items>
         <ext:ListItem Text="" Value="-1" />
    </Items>
    and set AlwaysMergeItems="true" for the combo (always add empty items to store after the store loading)

Similar Threads

  1. Get previous tab panel index
    By AlexMaslakov in forum 1.x Help
    Replies: 8
    Last Post: Nov 08, 2011, 2:03 AM
  2. [CLOSED] Combobox - Get Previous Selection on Select Event
    By sadaf in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 17, 2011, 4:11 PM
  3. Replies: 1
    Last Post: Dec 06, 2010, 8:49 PM
  4. Combobox - clear previous choosen item
    By mrozik in forum 1.x Help
    Replies: 4
    Last Post: Sep 06, 2009, 6:15 PM
  5. Why do i get the previous id field?
    By afhi in forum 1.x Help
    Replies: 6
    Last Post: Nov 08, 2008, 10:32 AM

Posting Permissions