2014-09-19 57 views
1

我使用的是FullCalendar,我必须在“月份”视图的每一天追加一个“选择”。FulllCalendar jquery,选择里面的日子

我得到了每个单元格中的选择,但它没有扩展。如果我以编程方式展开选择(更改大小),它会展开,但我无法选择任何选项。我也无法在Day Cell中选择任何文本或元素。我认为单元格阻塞了某些东西,点击正常工作

JsFiddle:http://jsfiddle.net/L17jzba6/ 我不需要任何事件,我使用日历为每天挑选信息并保存它。

$(document).ready(function() { 
     var fechaHoy = new Date(); 
     var fechaFormateada = $.format.date(fechaHoy, "yyyy-MM-dd"); 
     $('#calendar').fullCalendar({ 
      header: { 
       left: 'prev,next today', 
       center: 'title', 
       right: '' 
      }, 
      defaultDate: fechaFormateada,    
      monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 
       'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'], 
      dayNames: ['Domingo', 'Lunes', 'Martes', 'Miercoles', 
       'Jueves', 'Viernes', 'Sabado'], 
      dayNamesShort: ['Domingo', 'Lunes', 'Martes', 'Miercoles', 
       'Jueves', 'Viernes', 'Sabado'], 

      viewRender: function(view, element) { 
       //var fecha = $.format.date(view.start._d, "dd-MM-yyyy"); 
       //dia = fecha.substr(0, 2); 
       //mes = fecha.substr(3, 2); 
       //ano = fecha.substr(6, 4); 
       $("td[data-date]:not(.fc-other-month):not(.fc-day-number)").each(function() { 
        var fechaCelda = $(this).attr("data-date"); 
        if ($(this).hasClass("fc-past")) { 

         var html = '<select><option value="1">1</option><option value="2">2</option></select>'; 
         $(this).append(html); 
        } 
        else { 
             var html = '<select><option value="1">1</option><option value="2">2</option></select>'; 
         $(this).append(html); 
        } 
       }); 
      } 
     }); 
    }); 
+0

您的代码适合我。你可以发布一个jsfiddle或[sofiddle](http://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/)来演示这个问题吗? – brasofilo 2014-09-19 21:38:44

+0

这就是我拥有的一切。这些选择是正确的?我尝试在这里插入一个选择http://fullcalendar.io/,它不像我的日历那样扩展。 – 2014-09-20 23:20:55

+1

jsfiddle http://jsfiddle.net/L17jzba6/ – 2014-09-21 20:14:53

回答

0

猜测这是很久以前,但我有同样的问题,选择和输入不工作。经过漫长的试验和错误,我通过将$('#selectid')。mousedown(function(event){event.stopPropagation()})添加到select中来工作。 fullcalendar将事件绑定到mousedown,它以某种方式阻止输入元素的默认浏览器行为,例如通过停止mousedown传播来阻止fullcalendar事件触发有选择性地扩展,输入焦点等等。固定 google code issue(即时通讯使用版本2.3.2 fullcalendar)