[CLOSED] Combo Box Pre-Selection Problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Combo Box Pre-Selection Problem

    Hi

    I have tried to develop a drop down list that pre-selects a value in the Example

    https://examples1.ext.net/#/Form/Com...Custom_Search/

    I have added the script:

        <script type="text/javascript">
            function afterRender(e)
            {
                var val = "cowslip";
                e.store.baseParams = { preSelect: val };
                        
                var store = e.getStore();
                store.on("load", function ()
                {
                    e.setValue(val);
                    if (e.store.data.length == 0)
                    {
                        e.clearValue();
                    }
                });
                store.load();
                clensePreSelect(e);
                
            }
    
            function clensePreSelect(selector)
            {
                selector.store.baseParams = { preSelect: null };
                selector.store.removeAll(true);
                selector.store.clearData();
                selector.setValue(null);
                selector.clearValue();
                selector.setRawValue(null);
                selector.lastQuery = null;
                selector.store.totalLength = 0;
            }
            function checkValue(selector)
            {
                clensePreSelect(selector);
            }
        </script>
    Adding this markup to the combobox item itself:

                            <Triggers>
                                <%--<ext:FieldTrigger Icon="SimpleWrench" Qtip="Check value" />--%>
                                <ext:FieldTrigger Icon="Clear" Qtip="Clear" />
                            </Triggers>
                            <Listeners>
                                <AfterRender Handler="afterRender(this);" />               
                                <TriggerClick Handler="checkValue(this);"  />  
                            </Listeners>
    However, when it loads it successfully selects "cowslip", but if you hit clear and then perform another search:
    1) If you type too slow, it pre-selects "cowslip" again, and you end up typing in the middle of the word cowslip.
    2) If you search for something that isnt in the store, it clears what you have typed in.
    3) If you search for something that is in the store, eg *, it replaces what you searched for with "cowslip". Even though the list search correctly and you selected an item in it.

    Hope you can help, this is driving me bonkers! :)

    Ian
    Last edited by Daniil; Jun 13, 2011 at 3:52 PM. Reason: [CLOSED]

Similar Threads

  1. [CLOSED] Combo initialization with no selection on window show.
    By FAS in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Feb 22, 2012, 4:53 PM
  2. Replies: 0
    Last Post: Jan 06, 2010, 6:41 AM
  3. Replies: 3
    Last Post: Dec 10, 2009, 10:51 AM
  4. Combo Force Selection
    By simonmicheal in forum 1.x Help
    Replies: 0
    Last Post: Aug 26, 2009, 11:34 AM
  5. Combo Force Selection
    By simonmicheal in forum 1.x Help
    Replies: 3
    Last Post: Aug 15, 2009, 2:30 PM

Tags for this Thread

Posting Permissions