开发者

Rails 3 and jQuery Datepicker

i need advice about my problem, i use jquery ui DateP开发者_开发技巧icker, this work really good in my rails problem, but in the form i use with this jquery, i have a white row appear at the end of the page. When i select the field with Datepicker and choose a date, the white row disappears.

my jquery are like this

jQuery(function() {
   $(".showcal").datepicker({showOn:'both'});
}

my form have a text_field

<%= f.text_fields :first_date, :class => showcal %>

I use jQuery min 1.6.2 My Layout head

  <head>
    <title><%= content_for?(:title) ? yield(:title) : "Cadifice" %></title>
    <%= stylesheet_link_tag "application" %>
<%= stylesheet_link_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css", "application" %>
<%= stylesheet_link_tag "jquery.fancybox-1.3.4", "application" %>
<%= stylesheet_link_tag "jquery.highlight-3", "application" %>
<%= stylesheet_link_tag 'bottom' %>
    <%= javascript_include_tag :defaults %>

<%= javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", "https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.15/jquery-ui.min.js", "application" %> 
<%= javascript_include_tag 'pikachoose', 'jquery.pikachoose.full' %>
<%= javascript_include_tag 'cadifice', 'jquery.cadifice' %>

    <%= csrf_meta_tag %>
    <%= yield(:head) %>
  </head>

thanks


I also encounter that problem every now and then. For some reason (bug?) the datepicker panel sometimes does not get hidden. A simple workaround is add one more line to hide it yourself after initialising the datepickers. For exmaple,

$(".showcal").datepicker({showOn:'both'});
$('#ui-datepicker-div').hide();


If you are loading Prototype per my comments on your question, take a look at my answer here to another question involving RoR and jQuery. It resolved that person's issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜