可以在pickadate.js中使用多个日期

时间:2015-06-19 05:56:31

标签: jquery ruby-on-rails ruby-on-rails-4 pickadate

我在应用程序中使用pickadate。这里我将假期动态存储在数据库中。我用gem' gon'来获取那个日期。

gon.holidays = @holidays.collect { |holiday| [holiday.date] }

在application.js

 alert(gon.holidays);

输出

When I load my page alert gives this output

禁用pickadate中的日期。我跟着

$( '.new_leave_datepicker' ).pickadate({
        selectMonths: true,
        selectYears: 25,
        disable: [
           new Date([2015,06,22]),
            new Date([2015,06,23])
        ],
        min: Date.now()
    });

当我输入这些静态值时,pickadate会禁用这些日期,但我想禁用那些来自gon gem的日期。请指导我如何使用jquery的每个功能。提前致谢

1 个答案:

答案 0 :(得分:0)

嗨,请尝试这可能会帮助你

//I have tried overriding
public class GetTimeServlet extends HttpServlet 
{

    private static final long serialVersionUID = 1L;

    public void doPost (HttpServletRequest request,HttpServletResponse response) 
            throws ServletException, IOException 
    {
        StringBuilder sb = new StringBuilder();
        BufferedReader reader = request.getReader();
        try {
            String line;
            while ((line = reader.readLine()) != null) {
                sb.append(line);
            }
        } finally {
            reader.close();
        }
        response.setHeader("Cache-Control", "no-cache");
        response.setHeader("Pragma", "no-cache");
        response.setHeader("Access-Control-Allow-Origin", "*");
        PrintWriter out = response.getWriter();
        newtest.DbQueries dbq = new newtest.DbQueries();
        out.print((int) Math.round(dbq.getSiteScore(sb.toString())));
    }
}