2012-09-21 78 views
1

我不確定這是一個錯誤還是什麼,但是我在jQuery mobile的datepicker中遇到了一個非常奇怪的行爲。jquery mobile datepicker中的消失日期(非常奇怪)

點擊禁用日期時,啓用日期消失! WTF? http://jsfiddle.net/X5qp8/

我jQuery的針對移動黑客的建議後模擬這種:http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/

我還在它渲染到一個div,因爲我需要

請了一個很簡單的例子,看看我的jsfiddle一個持久的日曆。也許這些東西只是不嘲弄......

我還發現該錯誤就在於他們的移動擴展的33線,但目前還不清楚他們所試圖做的有:

$(".ui-datepicker-calendar .ui-btn", dp).each(function(){ 
      var el = $(this); 
      // remove extra button markup - necessary for date value to be interpreted correctly 
      el.html(el.find(".ui-btn-text").text()); 
     }); 

回答

1

第33行剝離了額外的標記,以便datepicker插件可以解析插件各種事件的日期。我最近找到了一個適用於我的解決方案,但是我無法讓你的jsFiddle正常工作。我已經評論了一些移動樣式正在做的額外標記。看看我的版本updateDatepicker函數,希望它會有幫助。

function updateDatepicker(){ 

    // $(".ui-datepicker-header", dp).addClass("ui-body-c ui-corner-top").removeClass("ui-corner-all"); 
    $(".ui-datepicker-prev, .ui-datepicker-next", dp).attr("href", "#"); 
    $(".ui-datepicker-prev", dp).buttonMarkup({iconpos: "notext", icon: "arrow-l", shadow: true, corners: true}); 
    $(".ui-datepicker-next", dp).buttonMarkup({iconpos: "notext", icon: "arrow-r", shadow: true, corners: true}); 
    // $(".ui-datepicker-calendar th", dp).addClass("ui-bar-c"); 
    // $(".ui-datepicker-calendar td", dp).addClass("ui-body-c"); 
    // $(".ui-datepicker-calendar a", dp).buttonMarkup({corners: false, shadow: false}); 
    $(".ui-datepicker-calendar a.ui-state-active", dp).addClass("ui-btn-active"); // selected date 
    $(".ui-datepicker-calendar a.ui-state-highlight", dp).addClass("ui-btn-up-e"); // today"s date 
    $(".ui-datepicker-calendar .ui-btn", dp).each(function(){ 
      var el = $(this); 
      // remove extra button markup - necessary for date value to be interpreted correctly 
     el.html(el.find(".ui-btn-text").text()); 
    }); 
}; 
+0

是的!你已經爲我工作了!我已經開始使用[datebox](http://dev.jtsage.com/jQM-DateBox/)插件了,但它沒有被記錄,臃腫且難以實現, m喜歡這個版本,並樂意讓它工作,謝謝你。 – stagl

0

除去<div id="datepicker"></div>
$("#date").datepicker({minDate : '9/20/2012'});

更換 $("#datepicker").datepicker({minDate : '9/20/2012'});
,也將努力

+0

我忘了提及我需要一個持久的日曆。 :( – stagl

+0

所以試着用jQuery 1.8.0它的工作原理沒有錯誤 – Ouadie

+0

當你將小提琴切換到1.8時,它不支持jquery移動框架,你沒有看到一個有效的測試,謝謝你的測試! – stagl