Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Administrator
Platform
Commits
b409dfa8
Unverified
Commit
b409dfa8
authored
Sep 15, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Manually handle the table + pagination
parent
c81ba02d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
18 deletions
+61
-18
PageTable.vue
Modules/Page/Assets/js/components/PageTable.vue
+61
-18
No files found.
Modules/Page/Assets/js/components/PageTable.vue
View file @
b409dfa8
...
...
@@ -3,15 +3,18 @@
<div
class=
"col-xs-12"
>
<div
class=
"box box-primary"
>
<div
class=
"box-body"
>
<data-tables
:data=
"data"
:actions-def=
"actionsDef"
>
<el-table-column
prop=
"id"
label=
"Id"
width=
"100"
>
<el-table
:data=
"data"
stripe
style=
"width: 100%"
@
sort-change=
"handleSortChange"
>
<el-table-column
prop=
"id"
label=
"Id"
width=
"100"
sortable
>
</el-table-column>
<el-table-column
prop=
"t
itle"
:label=
"translate('page', 'title')"
>
<el-table-column
prop=
"t
ranslations.title"
:label=
"translate('page', 'title')"
sortable
>
</el-table-column>
<el-table-column
prop=
"
slug"
label=
"Slug"
>
<el-table-column
prop=
"
translations.slug"
label=
"Slug"
sortable
>
</el-table-column>
<el-table-column
prop=
"created_at"
label=
"Created at"
>
<el-table-column
prop=
"created_at"
label=
"Created at"
sortable
>
</el-table-column>
<el-table-column
fixed=
"right"
prop=
"actions"
label=
"Actions"
>
<template
scope=
"scope"
>
...
...
@@ -22,7 +25,20 @@
</delete-button>
</
template
>
</el-table-column>
</data-tables>
</el-table>
<div
class=
"sc-table"
>
<div
class=
"pagination-wrap"
>
<el-pagination
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:current-page
.
sync=
"meta.current_age"
:page-sizes=
"[10, 20, 50, 100]"
:page-size=
"parseInt(meta.per_page)"
layout=
"total, sizes, prev, pager, next, jumper"
:total=
"meta.total"
>
</el-pagination>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -40,28 +56,55 @@
data
()
{
return
{
data
,
actionsDef
:
{
def
:
[{
name
:
this
.
translate
(
'
page
'
,
'
create page
'
),
icon
:
'
edit
'
,
handler
:
()
=>
{
this
.
$router
.
push
({
name
:
'
admin.page.page.create
'
})
}
}]
}
meta
:
{},
links
:
{},
}
},
methods
:
{
fetchData
()
{
let
vm
=
this
;
axios
.
get
(
route
(
'
api.page.page.index
'
))
.
then
(
response
=>
{
vm
.
data
=
response
.
data
.
data
;
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
this
.
links
=
response
.
data
.
links
;
});
},
goToEdit
(
scope
)
{
this
.
$router
.
push
({
name
:
'
admin.page.page.edit
'
,
params
:
{
pageId
:
scope
.
row
.
id
}})
},
handleSizeChange
(
event
)
{
console
.
log
(
'
per page :
'
+
event
);
axios
.
get
(
route
(
'
api.page.page.index
'
,
{
per_page
:
event
,
page
:
this
.
meta
.
current_page
}))
.
then
(
response
=>
{
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
this
.
links
=
response
.
data
.
links
;
});
},
handleCurrentChange
(
event
)
{
console
.
log
(
'
current page :
'
+
event
);
axios
.
get
(
route
(
'
api.page.page.index
'
,
{
page
:
event
,
per_page
:
this
.
meta
.
per_page
}))
.
then
(
response
=>
{
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
this
.
links
=
response
.
data
.
links
;
});
},
handleSortChange
(
event
)
{
console
.
log
(
'
sorting
'
,
event
);
axios
.
get
(
route
(
'
api.page.page.index
'
,
{
page
:
this
.
meta
.
current_page
,
per_page
:
this
.
meta
.
per_page
,
order_by
:
event
.
prop
,
order
:
event
.
order
,
}))
.
then
(
response
=>
{
this
.
data
=
response
.
data
.
data
;
this
.
meta
=
response
.
data
.
meta
;
this
.
links
=
response
.
data
.
links
;
});
},
},
mounted
()
{
this
.
fetchData
();
...
...
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