admin管理员组文章数量:1293597
In Highstock, you can use the jquery ui datepicker instead of inputting text into the date fields, as in this demo... /
datepicker
Clicking the input once, opens the datepicker where it should be below the input field, however if you close it and open it again it then sticks to the top of the container. Implemented in a webpage this would be the top of the browser window.
Is this a known issue?
In Highstock, you can use the jquery ui datepicker instead of inputting text into the date fields, as in this demo... http://jsfiddle/hcharge/aNde9/
datepicker
Clicking the input once, opens the datepicker where it should be below the input field, however if you close it and open it again it then sticks to the top of the container. Implemented in a webpage this would be the top of the browser window.
Is this a known issue?
Share Improve this question asked Feb 21, 2013 at 16:19 hchargehcharge 1,2462 gold badges24 silver badges43 bronze badges2 Answers
Reset to default 8 +50The datepicker controls its vertical position through the 'top' attribute of the widget's style - for some reason the 'top' is always set to 0 in subsequent datepicker activations.
It is relatively easy to workaround though if we have the widget's data 'remember' the correct position and explicitly set that position in the subsequent calls. See the 'onClose' and 'beforeShow' functions defined within the datePicker options below:
$.getJSON('http://www.highcharts./samples/data/jsonp.php?filename=aapl-c.json&callback=?', function(data) {
// Create the chart
window.chart = new Highcharts.StockChart({
chart : {
renderTo : 'container'
},
rangeSelector : {
selected : 1,
inputDateFormat: '%Y-%m-%d',
inputEditDateFormat: '%Y-%m-%d'
},
title : {
text : 'AAPL Stock Price'
},
series : [{
name : 'AAPL',
data : data,
tooltip: {
valueDecimals: 2
}
}]
}, function(chart){
// apply the date pickers
setTimeout(function(){
$('input.highcharts-range-selector', $('#'+chart.options.chart.renderTo))
.datepicker({
beforeShow: function(i,obj) {
$widget = obj.dpDiv;
window.$uiDatepickerDiv = $widget;
if ($widget.data("top")) {
setTimeout(function() {
$uiDatepickerDiv.css( "top", $uiDatepickerDiv.data("top") );
},50);
}
}
,onClose: function(i,obj) {
$widget = obj.dpDiv;
$widget.data("top", $widget.position().top);
}
})
},0)
});
});
Here's a link to jsFiddle
You need to set the same input formats, so or change in datepicker dateFormat
to the same as in Highstock , or change inputRangeFormat
in Highstock.
本文标签: javascriptHighstock date input jquery ui datepicker position changesStack Overflow
版权声明:本文标题:javascript - Highstock date input jquery ui datepicker position changes - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741584126a2386743.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论