Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Month-Year Datepicker missing OK button #1511

Closed
sendf opened this issue Apr 27, 2024 · 1 comment
Closed

[bug] Month-Year Datepicker missing OK button #1511

sendf opened this issue Apr 27, 2024 · 1 comment

Comments

@sendf
Copy link

sendf commented Apr 27, 2024

I'm trying to show a datepicker for Month & Year only, and I have configured the element as shown below:
image

However, on the frontend there is no OK/confirm button to submit the selection, and therefore the datepicker does not actually return any value selected:
image

Component only works when 'Show Days' is enabled.

@sendf sendf changed the title (bug) Month-Year Datepicker missing OK button [bug] Month-Year Datepicker missing OK button Apr 27, 2024
@akorchev akorchev transferred this issue from radzenhq/radzen-blazor-studio May 17, 2024
@enchev
Copy link
Collaborator

enchev commented May 23, 2024

There is no OK button for such view - ShowButton property is used to show/hide the button for the input that will show the popup. You can define your own FooterTemplate if you need such button:

<div class="rz-p-12 rz-text-align-center">
    <RadzenLabel Text="Select Year/Month" Component="DatePickerYearMonth" Style="margin-right: 8px; vertical-align: middle;" />
    <RadzenDatePicker @ref=dp @bind-Value=@value ShowDays=false DateFormat="yyyy/MM" CurrentDateChanged=@OnCurrentDateChanged Name="DatePickerYearMonth">
        <FooterTemplate>
            <RadzenButton Click=@(args => { value = (DateTime)dp.Value; dp.Close(); } ) Text="Ok" class="my-3 w-100" />
        </FooterTemplate>
    </RadzenDatePicker>
</div>

@code {
    RadzenDatePicker<DateTime> dp;
    DateTime value = DateTime.Now;

    void OnCurrentDateChanged(DateTime args)
    {
        value = new DateTime(args.Year, args.Month, 1);
    }
}

image

@enchev enchev closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants