Jump to content

UniDateTimePicker


picyka

Recommended Posts

procedure TUniMainModule.UniGUIMainModuleNewComponent(AComponent: TComponent);
begin
  if AComponent is TfrxReport then
    (AComponent as TfrxReport).EngineOptions.UseGlobalDataSetList := False
  else
  if AComponent is TUniCustomDateTimePicker then
    TUniDateTimePicker(AComponent).ConfigureFormatDate    <<<<<<-------
  else
  if AComponent is TUniDBGrid then
  begin
    TUniDBGrid(AComponent).ConfirureOpacity;
    TUniDBGrid(AComponent).ConfigureZebra;
  end;
end;

 

Link to comment
Share on other sites

há 1 hora, picyka disse:

Sim, é usado também.

function beforeInit(sender, config) 
{       
    config.altFormats="dmY|d/m/Y|j/n/Y|j/n/y|j/m/y|d/m/y|j/m/Y|d/n/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|d-m-Y|j-n|j/n";
    config.selectMonth = null;
    config.createPicker = function() {
        var me = this,
            format = Ext.String.format;
        return Ext.create('Ext.picker.Month', {
            pickerField: me,
            ownerCt: me.ownerCt,
            renderTo: document.body,
            floating: true,
            hidden: true,
            focusOnShow: true,
            minDate: me.minValue,
            maxDate: me.maxValue,
            disabledDatesRE: me.disabledDatesRE,
            disabledDatesText: me.disabledDatesText,
            disabledDays: me.disabledDays,
            disabledDaysText: me.disabledDaysText,
            format: me.format,
            showToday: me.showToday,
            startDay: me.startDay,
            minText: format(me.minText, me.formatDate(me.minValue)),
            maxText: format(me.maxText, me.formatDate(me.maxValue)),
            listeners: {
                select: {
                    scope: me,
                    fn: me.onSelect
                },
                monthdblclick: {
                    scope: me,
                    fn: me.onOKClick
                },
                yeardblclick: {
                    scope: me,
                    fn: me.onOKClick
                },
                OkClick: {
                    scope: me,
                    fn: me.onOKClick
                },
                CancelClick: {
                    scope: me,
                    fn: me.onCancelClick
                }
            },
            keyNavConfig: {
                esc: function() {
                    me.collapse();
                }
            }
        });
    };
    config.onCancelClick = function() {
        var me = this;
        me.selectMonth = null;
        me.collapse();
    };
    config.onOKClick = function() {
        var me = this;
        if (me.selectMonth) {
            me.setValue(me.selectMonth);
            me.fireEvent('select', me, me.selectMonth);
        }
        me.collapse();
    };
    config.onSelect = function(m, d) {
        var me = this;
        me.selectMonth = new Date((d[0] + 1) + '/1/' + d[1]);
    };
}

 

Link to comment
Share on other sites

Just now, picyka said:
function beforeInit(sender, config) 
{       
    config.altFormats="dmY|d/m/Y|j/n/Y|j/n/y|j/m/y|d/m/y|j/m/Y|d/n/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|d-m-Y|j-n|j/n";
    config.selectMonth = null;
    config.createPicker = function() {
        var me = this,
            format = Ext.String.format;
        return Ext.create('Ext.picker.Month', {
            pickerField: me,
            ownerCt: me.ownerCt,
            renderTo: document.body,
            floating: true,
            hidden: true,
            focusOnShow: true,
            minDate: me.minValue,
            maxDate: me.maxValue,
            disabledDatesRE: me.disabledDatesRE,
            disabledDatesText: me.disabledDatesText,
            disabledDays: me.disabledDays,
            disabledDaysText: me.disabledDaysText,
            format: me.format,
            showToday: me.showToday,
            startDay: me.startDay,
            minText: format(me.minText, me.formatDate(me.minValue)),
            maxText: format(me.maxText, me.formatDate(me.maxValue)),
            listeners: {
                select: {
                    scope: me,
                    fn: me.onSelect
                },
                monthdblclick: {
                    scope: me,
                    fn: me.onOKClick
                },
                yeardblclick: {
                    scope: me,
                    fn: me.onOKClick
                },
                OkClick: {
                    scope: me,
                    fn: me.onOKClick
                },
                CancelClick: {
                    scope: me,
                    fn: me.onCancelClick
                }
            },
            keyNavConfig: {
                esc: function() {
                    me.collapse();
                }
            }
        });
    };
    config.onCancelClick = function() {
        var me = this;
        me.selectMonth = null;
        me.collapse();
    };
    config.onOKClick = function() {
        var me = this;
        if (me.selectMonth) {
            me.setValue(me.selectMonth);
            me.fireEvent('select', me, me.selectMonth);
        }
        me.collapse();
    };
    config.onSelect = function(m, d) {
        var me = this;
        me.selectMonth = new Date((d[0] + 1) + '/1/' + d[1]);
    };
}

 

I put it on the first line, but it doesn't resolve yet.

Link to comment
Share on other sites

13 minutos atrás, picyka disse:

config.altFormats="dmY|d/m/Y|j/n/Y|j/n/y|j/m/y|d/m/y|j/m/Y|d/n/Y|d-| m-Y|d/m|d-m|dm|dmy|dmY|d|d-m-Y|j-n|j/n";

 

Se eu te entendesse, eu teria que mudar essa configuração para trabalhar com mm/yyyyy isso?

config.altFormats="mY|m/Y|j/n/Y|j/n/y|j/m/y|m/y|j/m/Y|n/Y|m-y|m-Y|m|| meu|m-Y|j-n|j/n";

 

In this format it is almost 100% perfect, only the month I always have to inform two digits ex: 02/2022 if I type just 2 it doesn't get 02/2022

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...