[CLOSED] Define selected Position of dropdown-list in TimeField

  1. #1

    [CLOSED] Define selected Position of dropdown-list in TimeField

    Hello,

    is it possible to define the position of the selected value in the list of times in a TimeField?

    As standard the currenctly selected time is always the LAST entry in the dropdown-list when you click the dropdown-trigger.

    I want it to be the first entry in that dropdown list or ... much better... in the middle of the visible list.

    It´s a bit complicated to explain. I hope the attached screenshot will hel.

    Regards,

    Martin

    PS: This is a customer request and not my personal wish ;-)
  2. #2

    RE: [CLOSED] Define selected Position of dropdown-list in TimeField

    Hi,

    Please see the following sample. It works good for '17:45' but for 00:00 to 3:00 (top time) it scrolls incorrectly. Just play with this example. You can disable scroll adjustment for that top times

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!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 id="Head1" runat="server">
        <title></title>
        <link href="../../../../resources/css/examples.css" rel="stylesheet" type="text/css" />
        
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                TimeField1.SelectedTime = new TimeSpan(17, 45, 0);
            }
        </script>
        
        <script type="text/javascript">
            function select(index, scrollIntoView){
                this.selectedIndex = index;
                this.view.select(index);
                if(scrollIntoView !== false){
                    var el = this.view.getNode(index);
                    if(el){
                        this.innerList.scrollChildIntoView(el, false);
                        if(this.innerList.dom.scrollTop > 0){
                            this.innerList.dom.scrollTop = this.innerList.dom.scrollTop + (this.list.getHeight()/2);
                            this.innerList.dom.scrollTop = this.innerList.dom.scrollTop;                    
                        }
                    }
                }
    
            }
        </script>
    </head>
    <body>
        <form id="Form1" runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:TimeField ID="TimeField1" runat="server">
                <CustomConfig>
                    <ext:ConfigItem Name="select" Value="select" />
                </CustomConfig>
            </ext:TimeField>
        </form>
    </body>
    </html>
  3. #3

    RE: [CLOSED] Define selected Position of dropdown-list in TimeField

    Thanks! I will try it.

    Is there something you cannot do with Ext.NET/ExtJS? ;-)

Similar Threads

  1. Replies: 4
    Last Post: Jun 11, 2012, 4:27 PM
  2. [CLOSED] ComboBox with a GridPanel as dropdown list
    By bogc in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Sep 14, 2011, 6:00 PM
  3. [CLOSED] Dropdown Field List Position
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: Apr 14, 2011, 7:04 PM
  4. Replies: 6
    Last Post: Feb 08, 2011, 6:17 PM
  5. Placing checkbox in the dropdown List
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: Apr 24, 2010, 7:39 PM

Posting Permissions