我对我的应用程序的相同方面有两个问题,抽象视图是这样的:
该应用程序允许用户查看不同的视频剪辑。在后端/管理部分,管理员可以跟踪任何特定剪辑组的视图。例如,管理员可以选择Universal Studios
,选择date range: Beginning Date: 2015-01-1, End Date: 2016-01-1
并点击filter
,然后查看Universal
在此范围内收到的总观看次数。
问题是,对于其中一个, datepicker 不再有效,所以当我点击日期字段时,没有显示日历,我手动必须输入日期。对于两个人,我只能在最远的地方获得结果:2015-10-18
和2016-02-18
。当我输入2015-09-18
或之前的任何内容时,它都不会生成结果。
单击Chorme中的inspect元素
时出现以下错误错误:未捕获的TypeError:无法读取属性' apply'未定义的
*/
(function($) {
var _datepicker = jQuery.fn.datepicker;
$.fn.datepicker = function(options) {
var $date = _datepicker.apply(this, arguments); <--- this line
application.js需要
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require jquery-ui/draggable
//= require jquery-ui/sortable
//= require jquery-ui/autocomplete
//= require bootstrap
//= require carousel.js
//= require hover.js
//= require menu_js/modernizr.js
//= require menu_js/dlmenu.js
//= require custom.js
//= require bootstrap-tabs.js
//= require jquery.raty.js
//= require letsrate.js
//= require rails-timeago
//= require tinymce-jquery
//= require scrollTo.js
//= require clips.js
//= require jquery.sticky.js
//= require jquery-ui.min.js
//= require jquery.dynatable.js
//= require playlist.js
//= require index.js.coffee
index.html.erb snippit:
<tr>
<td><%= f.text_field :start_date, value: 1.month.ago.strftime('%Y-%m-%d') %></td>
<td><%= f.text_field :end_date, value: Time.now.strftime('%Y-%m-%d') %></td>
<td>
<%= f.submit "Filter", class: "btn btn-danger", data: {disable_with: 'Searching...'} %>
<%= link_to 'Clear Form', '#', id: "clear", class: 'btn btn-default' %>
</td>
</tr>