Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery日期选择器不使用cfdiv_Jquery_Jquery Ui_Coldfusion_Coldfusion 9 - Fatal编程技术网

jQuery日期选择器不使用cfdiv

jQuery日期选择器不使用cfdiv,jquery,jquery-ui,coldfusion,coldfusion-9,Jquery,Jquery Ui,Coldfusion,Coldfusion 9,我有一个非常简单的页面,它有cfgrid记录集。当您单击该行时,我将向cfdiv发送唯一id,并显示一个带有jqueryui日期选择器的页面。但是,当我单击一行时,日期选择器不起作用。我搜索了又搜索,不知道为什么。以下是我的代码,其中cfgrid和cfdiv是: <html> <head> <title>Submit Roomate Available</title> <meta http-equiv="Content-Type" conte

我有一个非常简单的页面,它有cfgrid记录集。当您单击该行时,我将向cfdiv发送唯一id,并显示一个带有jqueryui日期选择器的页面。但是,当我单击一行时,日期选择器不起作用。我搜索了又搜索,不知道为什么。以下是我的代码,其中cfgrid和cfdiv是:

<html>
<head>
<title>Submit Roomate Available</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<!---<script src="../assets/js/jQuery126-min.js""></script>--->
<script src="../assets/js/jquery-1.7.2.min.js""></script>
<script src="../assets/js/jquery-ui-1.8.21.custom.min.js""></script>

<link href="../assets/css/flick/jquery-ui-1.8.21.custom.css" rel="stylesheet" type="text/css">

</head>




<cfquery name="findrec" datasource="#datasourcename#">
    SELECT *
        FROM students
        WHERE class = 'rmavail'
    order by last
</cfquery>
<cflayout type="accordion" width="677">
    <cflayoutarea title="Listings">
        <cfform>
        <cfgrid name="listings"
                width="677"
                height="200"
                format="html"
                query="findrec">

                <cfgridcolumn name="listingID" header="Listing ID"/>
                <cfgridcolumn name="first" header="First Name"/>
                <cfgridcolumn name="last" header="Last Name"/>
                <cfgridcolumn name="dateListed" header="Date Listed"/>
                <cfgridcolumn name="email" header="Email"/>
                <cfgridcolumn name="active" header="Active"/>

        </cfgrid>
        </cfform>
    </cflayoutarea>

</cflayout>

<cfdiv bind="url:admin_rma.cfm?listingid={listings.listingID}&func=Edit"/>

</body>
这是cfdiv加载admin_rma.cfm的页面-这是日期选择器所在的位置,希望我可以开始工作。我已经把jquery库放在哪里的每一个组合都联系起来了,这只是其中的一个组合

<script>
$(function() {
    $( "#datepicker" ).datepicker({ maxDate: "+1m +1w" });
});
</script>

<table cellpadding="0" cellspacing="0" width="698" align="center">
    <tr align="left" class="formheaders">
        <td>
            <font color="red">*</font>Date Available</span> (mm/dd/yyyy) <br>
            <input id="datepicker" type="text">
        </td>
    </tr>
</table>

使用firebug,确保正在加载jQuery。
如果您使用的是jQuery UI,您可能不想使用cflayout type=accordion。

这是因为在cfdiv标记上呈现html内容之前执行javascript。在调用datepicker之前,尝试使用setTimeout函数提供一些延迟,它应该可以工作。试试下面

<script>
setTimeout(function() {
    $( "#datepicker" ).datepicker({ maxDate: "+1m +1w" });
},500);
</script>
<table cellpadding="0" cellspacing="0" width="698" align="center">
    <tr align="left" class="formheaders">
        <td>
            <font color="red">*</font>Date Available</span> (mm/dd/yyyy) <br>
            <input id="datepicker" type="text">
        </td>
    </tr>
</table>
在本例中,我在创建datepicker对象之前提供500毫秒的延迟,以确保输入字段已在html上下文中呈现。PS:这不是合适的解决方案,因为根据浏览器功能和html内容的大小,将html内容加载到cfdiv可能需要500毫秒以上。这只是为了证明datepicker函数在加载之前调用过


希望这个帮助。

因为您需要先初始化它。我会考虑尝试一个ExtJS DeaPosik-将使用基于ExtJS的CaldFixon实现的Ajax。