我在一个页面上初始化了多个CalHeatMap对象:
....
{% for row in queryset %}
var cal{{ forloop.counter }} = new.CalHeatMap();
cal{{ forloop.counter }}.init(
{id:"cal{{ forloop.counter }}", itemSelector: "#previousSelector-a", previousSelector: "#previousSelector-a-previous", domain: 'day', subDomain:'hour', colLimit: 24, range: 4, displayLegend: false, domainLabelFormat: ""}
);
{% endfor %}
....
{% for row in queryset %}
<div id="cal{{ forloop.counter }}"></div>
{% endfor %}
<div id="previousSelector-a" style="nullposition:relative;">
<button class="btn" id="previousSelector-a-previous">Previous</button>
</div>
但我希望能够使用上一个和下一个选择器,这样当我点击它们时,它们将进行所有日历,而不仅仅是最后一个日历,就像现在的情况一样?
答案 0 :(得分:1)
使用itemNamespace
选项,并为每个日历实例分配不同的命名空间。