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

single picker and buttons not visible #84

Open
MohammadMrz opened this issue Jan 26, 2023 · 1 comment
Open

single picker and buttons not visible #84

MohammadMrz opened this issue Jan 26, 2023 · 1 comment

Comments

@MohammadMrz
Copy link

MohammadMrz commented Jan 26, 2023

I'm using below code to have buttons displayed on the single date picker.
However the buttons are not appearing

`

  <DateRangePicker SingleDatePicker="true" 
      @bind-StartDate="StartDate" 
      @bind-EndDate="EndDate" 
      Context="contekst"
      ApplyButtonClasses="single-picker-buttons"
  >
      <ButtonsTemplate>
          <button class="cancelBtn btn btn-sm btn-default"
      @onclick="@contekst.ClickCancel" type="button">
              Cancel
          </button>
          <button class="cancelBtn btn btn-sm btn-default"
      @onclick="@(e => ResetClick(e, contekst))" type="button">
              Reset
          </button>
          <button class="applyBtn btn btn-sm btn-primary" @onclick="@contekst.ClickApply"
      disabled="@(contekst.TStartDate == null || contekst.TEndDate == null)"
      type="button">
              Apply
          </button>
      </ButtonsTemplate>
  </DateRangePicker>

  @code {
DateTimeOffset? StartDate { get; set; }
DateTimeOffset? EndDate { get; set; }

void ResetClick(MouseEventArgs e, DateRangePicker picker)
{
StartDate = null;
EndDate = null;
// Close the picker
picker.Close();
// Fire OnRangeSelectEvent
picker.OnRangeSelect.InvokeAsync(new DateRange());
}
}

`

@MohammadMrz MohammadMrz changed the title single picker and buttons single picker and buttons not visible Jan 27, 2023
@MohammadMrz
Copy link
Author

The buttons get hidden when the component is in such a mode where it can auto apply the provided value. You can control this thrugh a parameter called AutoApply. The odd thing is that its defualt value is different based on whether the component is in single or multi mode, which might be a bit confusing.

To solve the issue and show the buttons, you can do one of the following:

explicitly set the AutoApply="false"
override the display styling applied to their div wrapper.

Both workarounds are shown here: https://blazorrepl.telerik.com/wHkbnaYW46S27TQd50

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

1 participant