Скрытие графика при отсутствии выбранных категорий для отображения, формирование…

Скрытие графика при отсутствии выбранных категорий для отображения, формирование списка актуальных категорий таблицы
parent b2f8429a
...@@ -3,14 +3,14 @@ $(document).ready(function(){ ...@@ -3,14 +3,14 @@ $(document).ready(function(){
var var
selectorGraphChartStat = '#chart-graph-stat', selectorGraphChartStat = '#chart-graph-stat',
selectorActiveLine = '.b-filter__switch.current-metric .m-filter__switch-item_active', selectorActiveLine = '.b-filter__switch.current-metric .m-filter__switch-item_active',
selectorActiveTime = '.b-filter__switch.time .m-filter__switch-item_active', //selectorActiveTime = '.b-filter__switch.time .m-filter__switch-item_active',
selectorActiveDays = '.b-filter__switch.days .m-filter__switch-item_active', //selectorActiveDays = '.b-filter__switch.days .m-filter__switch-item_active',
selectorActiveData = '.b-filter__switch.metric-data .m-filter__switch-item_active', //selectorActiveData = '.b-filter__switch.metric-data .m-filter__switch-item_active',
activeLine = $(selectorActiveLine).data('filter-category'), activeLine = $(selectorActiveLine).data('filter-category'),
activeTime, //activeTime,
activeDays, activeDays,
toggelDates = [], toggelDates = [],
selectedCategoriesId = [], //selectedCategoriesId = [],
weekDatesDataStart, weekDatesDataStart,
colorsActiveLines = { colorsActiveLines = {
'shows' : '#2CA02C', 'shows' : '#2CA02C',
...@@ -125,6 +125,14 @@ $(document).ready(function(){ ...@@ -125,6 +125,14 @@ $(document).ready(function(){
// Определяем названия в легенде: // Определяем названия в легенде:
var selectedCategoriesId = $.TableStat.CheckedCategories(); var selectedCategoriesId = $.TableStat.CheckedCategories();
//console.log('AAA selectedCategoriesId = ', selectedCategoriesId); //console.log('AAA selectedCategoriesId = ', selectedCategoriesId);
// Скрываем график, если в таблице не выбраны категории:
if (selectedCategoriesId.length == 0) {
$(selectorGraphChartStat).hide();
return false;
} else {
$(selectorGraphChartStat).show();
}
for (var i = 1; i <= activeLines.length; i++) { for (var i = 1; i <= activeLines.length; i++) {
var currentActiveLine = activeLines[i-1]; var currentActiveLine = activeLines[i-1];
if (selectedCategoriesId.indexOf(currentActiveLine) > -1) { if (selectedCategoriesId.indexOf(currentActiveLine) > -1) {
......
...@@ -116,25 +116,13 @@ $(document).ready(function(){ ...@@ -116,25 +116,13 @@ $(document).ready(function(){
Render: function(dataLineChartStat) { Render: function(dataLineChartStat) {
// Формируем список переключателей (категорий) activeLines: // Формируем список переключателей (категорий) activeLines:
if (dataLineChartStat.report == 'common') {
activeLines = ['shows', 'clicks', 'transactions', 'salemoney', 'admoney'];
}
if (dataLineChartStat.report == 'transaction') {
activeLines = ['localmoney', 'usdollarmoney'];
}
/*
// Автоматизировать формирование списка категорий таблицы:
activeLines = []; activeLines = [];
$('thead.metric.sortable th input[type="checkbox"]', $table).each(function(){ $('thead.metric.sortable th b.cat', $table).each(function(){
if ($(this).is(":checked")) { activeLines.push($(this).attr('id'));
listCats.push($(this).data('field')); });
}
})
*/
//console.log('AAA TableStat render: ', dataLineChartStat); //console.log('AAA TableStat render: ', dataLineChartStat);
console.log('AAA activeLines: ', activeLines); //console.log('AAA activeLines: ', activeLines);
dataTable = {}; dataTable = {};
activeLines.forEach(function(item){ activeLines.forEach(function(item){
...@@ -155,7 +143,7 @@ $(document).ready(function(){ ...@@ -155,7 +143,7 @@ $(document).ready(function(){
if ($(this).is(":checked")) { if ($(this).is(":checked")) {
listCats.push($(this).data('field')); listCats.push($(this).data('field'));
} }
}) });
return listCats; return listCats;
}, },
......
...@@ -189,7 +189,7 @@ $system_link = $this->url('adm.system.actions'); ...@@ -189,7 +189,7 @@ $system_link = $this->url('adm.system.actions');
<input type="checkbox" data-field="<?= $name ?>" checked /> <input type="checkbox" data-field="<?= $name ?>" checked />
</span> </span>
<?php endif; ?> <?php endif; ?>
<b id="<?= $name ?>"><?= _t($name)?><!--<b class="arrow asc">&and;</b><b class="arrow desc">&or;</b>--></b> <b class="cat" id="<?= $name ?>"><?= _t($name)?><!--<b class="arrow asc">&and;</b><b class="arrow desc">&or;</b>--></b>
</th> </th>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment