【问题标题】:Is there any way to force open down a pcalendar on modal有什么办法可以强制打开模态日历
【发布时间】:2020-03-10 12:01:37
【问题描述】:

我有一个带有 p 日历的 p 对话框。问题是当我尝试打开日历时,它是向上打开的。我想向下打开。

<p-dialog responsive="true" modal="true" (onHide)="closeDialog()" #genericDialog 
   [(visible)]="displayModal"
   class="generic-dialog">

    <div *ngSwitchCase="'DATE_CUSTOM'" class="form-group form-control-head"
    [class.has-success]="formGroup.controls ? formGroup.controls[control.name].valid : false">
    <p-calendar [monthNavigator]="true" [yearNavigator]="true" [yearNavigator]="true" 
                [showTime]="false"
                [minDate]="dateMin" [maxDate]="dateMax" yearRange="2000:2030" dateFormat="dd/mm/yy" 
                [showIcon]="true"
                [style]="{'width': '95%'}" [inputStyle]="{'height': 'calc(1.5em + 0.75rem + 4px)', 
                'width': '100%'}"
                [formControlName]="control.name" [showButtonBar]="true" [locale]="calendarLang">
    </p-calendar>
  </div>
   <br>
  <p-footer>
     <div class="col-12 text-center mb-4">
        <button [disabled]="formGroup.invalid" (click)="submit()"
         class="btn btn-primary px-4">Save
         </button>
        &nbsp;&nbsp;&nbsp;
       <button type="button" class="btn btn-info px-4" (click)="closeDialog()"
             style="color: white">Cancel
       </button>
    </div>
  </p-footer>

</p-dialog>

【问题讨论】:

  • 你能创建一个stackblitz吗?
  • mmh 现在我不能……抱歉

标签: html css angular primeng


【解决方案1】:

很久以前我也遇到过同样的问题。我会直接说你不能强制 p-calendar 向下或向上打开。

因为它取决于p-calendar输入框上下的可用空间。

因此,要手动向上打开,请在输入框向上保留足够的空间,在向下的方向保留较少的空间。

这样你就可以实现了,希望对你有帮助!

【讨论】:

  • 哦,那太糟糕了.. 好的,谢谢您的建议和您的经验!!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-08-14
  • 2012-03-24
  • 2021-06-05
  • 2014-05-24
  • 2013-04-11
  • 2014-02-28
相关资源
最近更新 更多