Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
ViewAdminpanel
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amal
ViewAdminpanel
Commits
1cf3bc54
Commit
1cf3bc54
authored
Aug 22, 2019
by
Jansa Jose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
datatable in table page
parent
7a6385c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
20 deletions
+40
-20
Tables.vue
src/components/views/Tables.vue
+36
-20
routes.js
src/routes.js
+4
-0
No files found.
src/components/views/Tables.vue
View file @
1cf3bc54
...
...
@@ -15,21 +15,15 @@
</div>
<div
class=
"row"
>
<div
class=
"col-sm-12 table-responsive"
>
<table
aria-describedby=
"example1_info"
role=
"grid"
id=
"example1"
class=
"table table-bordered table-striped dataTable
"
>
<table
id=
"example1"
class=
"table table-bordered table-striped dataTable"
cellspacing=
"0"
width=
"100%
"
>
<thead>
<tr
role=
"row"
>
<th
aria-label=
"Date: activate to sort column descending"
aria-sort=
"ascending"
style=
"width: 167px;"
colspan=
"1"
rowspan=
"1"
aria-controls=
"example1"
tabindex=
"0"
class=
"sorting_asc"
>
Date
</th>
<th
aria-label=
"Description: activate to sort column ascending"
style=
"width: 207px;"
colspan=
"1"
rowspan=
"1"
aria-controls=
"example1"
tabindex=
"0"
class=
"sorting"
>
Description
</th>
<th
aria-label=
"Amount: activate to sort column ascending"
style=
"width: 182px;"
colspan=
"1"
rowspan=
"1"
aria-controls=
"example1"
tabindex=
"0"
class=
"sorting"
>
Amount
</th>
<th>
Date
</th>
<th>
Description
</th>
<th>
Amount
</th>
</tr>
</thead>
<!--
<tbody
v-if=
"transactions"
>
<tr
class=
"even"
role=
"row"
v-for=
"trans in transactions"
:key=
"trans"
>
<td
class=
"sorting_1"
>
{{
trans
.
date
}}
</td>
<td>
{{
trans
.
description
}}
</td>
<td>
{{
trans
.
amount
}}
</td>
</tr>
</tbody>
-->
<tbody></tbody>
</table>
</div>
</div>
...
...
@@ -51,17 +45,10 @@ require('datatables.net-bs')
export
default
{
name
:
'Tables'
,
mounted
()
{
this
.
getData
()
this
.
loadDatatable
()
this
.
access_token
=
localStorage
.
getItem
(
'token'
)
data
:
{
dataTable
:
null
},
methods
:
{
loadDatatable
()
{
this
.
$nextTick
(()
=>
{
$
(
'#example1'
).
DataTable
()
})
},
getData
()
{
var
params
=
{
'client_id'
:
config
.
clientId
,
'client_secret'
:
config
.
clientSecret
,
'access_token'
:
this
.
access_token
}
var
thisObj
=
this
...
...
@@ -84,6 +71,35 @@ export default {
toggleLoading
()
{
this
.
loading
=
this
.
loading
===
''
?
'loading'
:
''
}
},
mounted
()
{
let
users
=
[]
this
.
access_token
=
localStorage
.
getItem
(
'token'
)
this
.
dataTable
=
$
(
'#example1'
).
DataTable
({})
var
params
=
{
'client_id'
:
config
.
clientId
,
'client_secret'
:
config
.
clientSecret
,
'access_token'
:
this
.
access_token
}
var
thisObj
=
this
api
.
request
(
'post'
,
'listTransactions'
,
params
)
.
then
(
response
=>
{
thisObj
.
toggleLoading
()
var
data
=
response
.
data
if
(
data
.
status
===
'success'
)
{
data
.
data
.
resources
.
forEach
(
item
=>
{
users
.
push
(
item
)
})
users
.
forEach
(
user
=>
{
this
.
dataTable
.
row
.
add
([
user
.
date
,
user
.
description
,
user
.
amount
]).
draw
(
false
)
})
}
})
.
catch
(()
=>
{
thisObj
.
$store
.
commit
(
'TOGGLE_LOADING'
)
thisObj
.
response
=
'Server appears to be offline'
})
}
}
</
script
>
...
...
src/routes.js
View file @
1cf3bc54
...
...
@@ -11,6 +11,10 @@ const routes = [
component
:
LoginView
},
{
path
:
'/login'
,
component
:
LoginView
},
{
path
:
'/signup'
,
component
:
SignupView
},
...
...
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