[英]p:calendar does not work
I have a very strange problem regarding <p:calendar>
component.关于<p:calendar>
组件,我有一个非常奇怪的问题。 I have a calendar in a <p:panelGrid>
(see below), but when I open my page, calendar is not opened when clicked on a "input box" like it should.我在<p:panelGrid>
中有一个日历(见下文),但是当我打开我的页面时,单击“输入框”时不会打开日历。
<p:panelGrid>
<p:calendar value="#{backingBean.date}" />
</p:panelGrid>
Of course, date attribute is in my backing bean:当然,日期属性在我的支持 bean 中:
private Date date;
public void setDate(Date date) {
this.date = date;
}
public Date getDate() {
return date;
}
I just don't know what to do to make it work.我只是不知道该怎么做才能让它工作。 One more thing: there are problems with a ~` too.还有一件事: ~` 也有问题。 Just cannot click on it to select value.只是不能点击它来选择值。
PS: Using PF 5.1 PS:使用 PF 5.1
Make sure there is a <h:form>
in your page.确保您的页面中有一个<h:form>
。 Generally we specify一般我们指定
<p:calendar id="c1" pattern="yyyy/MM/dd HH:mm:ss" timeZone="IST"
value="#{backingBean.date}" showOn="button"/>
Checkout Primeface-caledar showcase for more calendar examples查看Primeface-caledar 展示以获取更多日历示例
could you try below code你能试试下面的代码吗
<p:panelGrid columns="1">
<p:calendar value="#{backingBean.date}" />
</p:panelGrid>
or或者
<p:panelGrid >
<p:row>
<p:column>
<p:calendar value="#{backingBean.date}" />
</p:column>
</p:row>
</p:panelGrid>
Found the cause of my problem.找到了我的问题的原因。 With my JS validation function, i tried to validate a component with id, that didn't exist.使用我的 JS 验证功能,我尝试使用不存在的 id 验证组件。 That's why my other components were unresponsive.这就是为什么我的其他组件没有响应的原因。
Should have thought about it before...之前应该考虑过...
import { BrowserAnimationsModule } from '@angular\/platform-browser\/animations';从'@angular\/platform-browser\/animations'导入{ BrowserAnimationsModule };
@NgModule({ imports: [ @NgModule({ 进口:[
. . . . . .
BrowserAnimationsModule,浏览器动画模块,
. . . . . .
], ],
. . . . . .
}) })
in app.module.ts in your project在你的项目中的 app.module.ts
"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.