将jquery datepicker集成到jsf中 [英] Integrating jquery datepicker into jsf

查看:82
本文介绍了将jquery datepicker集成到jsf中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我按照此处这里但我不能把它带到工作中。你可以帮帮我吗?

I was following the examples here and here but I cann't bring it to work. Could you help me please?

这里是我定义脚本的地方,下面是我(假设)使用它的地方......

Here is where I define the script and below where I (suppose to) use it...

<script>
$(function() {
    $( "#createDate" ).datepicker({
        showOn: "button",
        buttonImage: "images/calendar.gif",
        buttonImageOnly: true
    });
});
</script>

<ui:define name="columnFilters">
    <th>
        <h:inputText value="#{listModel.creationDate}" id="creationDate"
            valueChangeListener="#{listController.filterFieldChanged}">
            <f:convertDateTime pattern="yyyy-mm-dd"/>
        </h:inputText>
    </th>
    <th>
        <h:inputText value="#{listModel.updateDate}" id="upateDate"
            valueChangeListener="#{listController.filterFieldChanged}">
            <f:convertDateTime pattern="yyyy-mm-dd"/>
        </h:inputText>
    </th>
    <th> &nbsp; </th>
</ui:define>


推荐答案

jQuery ID选择器必须与生成的HTML客户端完全匹配您可以在浏览器中右键单击并查看源时看到的ID。

The jQuery ID selector must match exactly the generated HTML client ID, which you can see when you do rightclick and view source in browser.

而是使用类名上的钩子,这也允许您选择多个元素。例如

Rather use a hook on the classname instead, this also allows you to select multiple elements. E.g.

$(".datepicker").datepicker({
    showOn: "button",
    buttonImage: "images/calendar.gif",
    buttonImageOnly: true
});

with

<h:inputText value="#{listModel.creationDate}" styleClass="datepicker"
    valueChangeListener="#{listController.filterFieldChanged}">
    <f:convertDateTime pattern="yyyy-mm-dd"/>
</h:inputText>

<h:inputText value="#{listModel.updateDate}" styleClass="datepicker"
    valueChangeListener="#{listController.filterFieldChanged}">
    <f:convertDateTime pattern="yyyy-mm-dd"/>
</h:inputText>

这篇关于将jquery datepicker集成到jsf中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆