[CLOSED] Is it possible that the displayed calendar corresponds to the min/max date defined?

  1. #1

    [CLOSED] Is it possible that the displayed calendar corresponds to the min/max date defined?

    Hi Ext.Net Team !!

    Please check the code sample below:

    
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Multiple DateFields with DateRange Validation - 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>Multiple DateFields with DateRange Validation</h1>
    
            <p>This example demonstrates two date fields acting as a date range. Selecting an initial date sets the minimum value for the end field. Selecting an ending date sets a maximum value for the start field.</p>
    
            <p>If a value is specified / selected in the 'DateField1 field', the 'DateField2 field' doesn't allow any date prior to the 'DateField1' entry to be specified / selected and vice versa.</p>
    
            <ext:Window ID="Window1"
                runat="server"
                Width="350"
                Title="DateRange"
                Icon="Date"
                Closable="false"
                BodyPadding="5"
                Layout="Anchor"
                DefaultAnchor="100%">
                <Items>
                    <ext:DateField
                        ID="DateField1"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="From">
                        <Listeners>
                            <Change Handler="if (App.DateField2.getValue() == null) App.DateField2.setValue(newValue);" />
                        </Listeners>
                        <CustomConfig>
                            <ext:ConfigItem Name="endDateField" Value="DateField2" Mode="Value" />
                        </CustomConfig>
                    </ext:DateField>
    
                    <ext:DateField
                        ID="DateField2"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="To">
                        <CustomConfig>
                            <ext:ConfigItem Name="startDateField" Value="DateField1" Mode="Value" />
                        </CustomConfig>
                    </ext:DateField>
    
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Is it possible that the displayed calendar corresponds to the min/max date defined?

    I have taken your example to present my issue

    http://examples4.ext.net/#/Form/Date...From-To_Range/

    Step 1. For the From field, select a future date, for example March 01

    Step 2. For the To field, clicking on the calendar button displays the current month

    Can you help with the code?

    I accept suggestions ideas or comments, Hi Ext.Net Team !!

    Please check the code sample below:

    
    <%@ Page Language="C#" %>
    
    <!DOCTYPE html>
    
    <html>
    <head id="Head1" runat="server">
        <title>Multiple DateFields with DateRange Validation - 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>Multiple DateFields with DateRange Validation</h1>
    
            <p>This example demonstrates two date fields acting as a date range. Selecting an initial date sets the minimum value for the end field. Selecting an ending date sets a maximum value for the start field.</p>
    
            <p>If a value is specified / selected in the 'DateField1 field', the 'DateField2 field' doesn't allow any date prior to the 'DateField1' entry to be specified / selected and vice versa.</p>
    
            <ext:Window ID="Window1"
                runat="server"
                Width="350"
                Title="DateRange"
                Icon="Date"
                Closable="false"
                BodyPadding="5"
                Layout="Anchor"
                DefaultAnchor="100%">
                <Items>
                    <ext:DateField
                        ID="DateField1"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="From">
                        <Listeners>
                            <Change Handler="if (App.DateField2.getValue() == null) App.DateField2.setValue(newValue);" />
                        </Listeners>
                        <CustomConfig>
                            <ext:ConfigItem Name="endDateField" Value="DateField2" Mode="Value" />
                        </CustomConfig>
                    </ext:DateField>
    
                    <ext:DateField
                        ID="DateField2"
                        runat="server"
                        Vtype="daterange"
                        FieldLabel="To">
                        <CustomConfig>
                            <ext:ConfigItem Name="startDateField" Value="DateField1" Mode="Value" />
                        </CustomConfig>
                    </ext:DateField>
    
                </Items>
            </ext:Window>
        </form>
    </body>
    </html>
    Is it possible that the displayed calendar corresponds to the min/max date defined?

    I have taken your example to present my issue

    https://examples4.ext.net/#/Form/Dat...From-To_Range/

    Step 1. For the “From” field, select a future date, for example March 01

    Step 2. For the “To” field, clicking on the calendar button displays the current month

    Can you help with the code?

    I accept suggestions ideas or comments
    Last edited by fabricio.murta; Jan 27, 2017 at 5:56 AM.
  2. #2
    Hello @opendat2000!

    One thing you can do is just select the end date on the second field when you select the start date -- as the same date.

    Then when you open the picker it will be pointing to the start date.

    <Listeners>
        <Change Handler="if (App.DateField2.getValue() == null) App.DateField2.setValue(newValue);" />
    </Listeners>
    In the case above it will only fiddle with the end date on the first time the user does a selection and leave it alone from subsequent start date selections.

    To move the picker around without setting a date to the field would require extending the date picker component, though.

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hello FabrÃ*cio !

    Thanks for your quickly answer...

    But my question pointed to the presentation or display of the calendar, not a value selected in the “To” field

    With the indication that you have given me, the displayed result is as follows:

    Click image for larger version. 

Name:	DateField1.JPG 
Views:	38 
Size:	14.8 KB 
ID:	24823
    Click image for larger version. 

Name:	DateField2.JPG 
Views:	47 
Size:	24.0 KB 
ID:	24824

    But I expected this

    Click image for larger version. 

Name:	DateField3.JPG 
Views:	50 
Size:	24.1 KB 
ID:	24825

    I corrected the code according to your indications

    Saludos
    Mauricio Cardemil.
  4. #4
    Hello Mauricio!

    That's what I tried to say here:

    To move the picker around without setting a date to the field would require extending the date picker component, though.
    Here's a Sencha forums thread where people discussed likely this same issue, and for what I see there, they set an Expand event to switch the date to the other form's date. It actually looks simple enough and worth a try!
    - Datepicker - choose initial date

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello FabrÃ*cio !

    Thanks a lot for your reply.

    Please close the thread.

    Saludos
    Mauricio.

Similar Threads

  1. nl-NL date format displayed wrong
    By mturnhout in forum 2.x Help
    Replies: 9
    Last Post: Oct 24, 2014, 6:40 AM
  2. Calendar in window - no events displayed
    By reiben in forum 1.x Help
    Replies: 4
    Last Post: May 04, 2011, 3:41 PM
  3. [CLOSED] [1.0] Calendar date
    By FVNoel in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Mar 25, 2011, 12:07 PM
  4. DatePicker: get Min Date and Max Date just displayed
    By Journeyman79 in forum 1.x Help
    Replies: 0
    Last Post: Mar 16, 2011, 10:41 AM
  5. Replies: 1
    Last Post: Mar 03, 2009, 12:15 PM

Posting Permissions