Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
addcpm-json
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Александр Чаплыгин
addcpm-json
Commits
43ea90f1
Commit
43ea90f1
authored
Nov 12, 2018
by
Александр Чаплыгин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Подключил сортировку в стат. таблице
parent
1c221a7b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
script-feeds-stat-table.js
src/public/js/script-feeds-stat-table.js
+52
-1
cabinet-feed.phtml
src/templates/app/user/cabinet-feed.phtml
+1
-1
No files found.
src/public/js/script-feeds-stat-table.js
View file @
43ea90f1
...
...
@@ -40,6 +40,55 @@ $(document).ready(function(){
});
$row
.
appendTo
(
$tableContent
);
// Сортировка строк в таблице:
var
sortField
=
false
,
$selectedField
=
$
(
'#table-line thead th b.selected'
),
isDesc
=
true
;
if
(
$selectedField
.
length
>
0
)
{
sortField
=
$selectedField
.
attr
(
'id'
);
isDesc
=
$selectedField
.
hasClass
(
'desc'
);
}
if
(
sortField
)
{
//console.log('AAA sortField = ', sortField);
//console.log('AAA dataTable = ', dataTable);
var
dataTableForSort
=
[];
dataTable
.
period
.
forEach
(
function
(
dataTableItem
,
ind
){
var
dataTableSortItem
=
{};
dataTableSortItem
[
'period'
]
=
dataTableItem
;
activeLines
.
forEach
(
function
(
activeLine
){
dataTableSortItem
[
activeLine
]
=
dataTable
[
activeLine
][
ind
];
});
dataTableForSort
.
push
(
dataTableSortItem
);
});
dataTableForSort
.
sort
(
function
(
a
,
b
){
if
(
isDesc
)
{
return
b
[
sortField
]
-
a
[
sortField
];
}
else
{
return
a
[
sortField
]
-
b
[
sortField
];
}
});
//console.log('AAA dataTableForSort = ', dataTableForSort);
dataTableForSort
.
forEach
(
function
(
item
){
$row
=
$
(
'<tr>'
);
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
'period'
]));
activeLines
.
forEach
(
function
(
line
){
$row
.
append
(
$
(
'<td>'
).
html
(
item
[
line
]));
});
$row
.
appendTo
(
$tableContent
);
});
}
else
{
for
(
var
i
=
dataPeriod
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
...
...
@@ -60,6 +109,8 @@ $(document).ready(function(){
}
}
}
$
.
extend
({
TableStat
:
{
Render
:
function
(
dataLineChartStat
)
{
...
...
@@ -68,7 +119,7 @@ $(document).ready(function(){
activeLines
=
[
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
];
//console.log('AAA TableStat render: ', dataLineChartStat);
//
console.log('AAA activeLines: ', activeLines);
console
.
log
(
'AAA activeLines: '
,
activeLines
);
dataTable
=
{};
activeLines
.
forEach
(
function
(
item
){
...
...
src/templates/app/user/cabinet-feed.phtml
View file @
43ea90f1
...
...
@@ -146,7 +146,7 @@ $dates = $this->dates;
<th>
<?=
_t
(
'Дата/Компания'
)
?>
</th>
<?php
foreach
([
'shows'
,
'clicks'
,
'transactions'
,
'salemoney'
,
'admoney'
]
as
$name
)
:
?>
<th>
<input
type=
"checkbox"
/>
<input
type=
"checkbox"
data-field=
"
<?=
$name
?>
"
/>
<b
id=
"
<?=
$name
?>
"
>
<?=
_t
(
$name
)
?>
<!--
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment