Skip to content

Commit

Permalink
fix table sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
klgd committed Feb 2, 2018
1 parent fb753c1 commit f470928
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 38 deletions.
22 changes: 9 additions & 13 deletions resources/assets/components/views/model/box/table.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<style>
.el-table table, .el-table__empty-block {
width: 100% !important;
}
.el-table__body, .el-table__footer, .el-table__header {
table-layout: initial;
}
</style>
<template>
<div class="box">
<v-header
Expand All @@ -7,7 +15,6 @@
<!-- /.box-header -->
<div class="box-body table-responsive">
<el-table :data="tableData"
@sort-change="sortChange"
v-loading="loading">

<el-table-column
Expand Down Expand Up @@ -78,7 +85,6 @@
selection: [],
page: 1,
orderBy: {},
}
},
mixins: [
Expand Down Expand Up @@ -107,24 +113,14 @@
this.pageData = {};
this.loading = true;
var params = _.assign({'page': this.page}, this.filterParams, this.orderBy);
var params = _.assign({'page': this.page}, this.filterParams);
this.$http.get(`/${this.getUrlPrefix()}/${this.$route.params.model}/list`, {params: params})
.then(response => {
this.loading = false;
this.pageData = response.data;
}).catch(error => {
})
},
sortChange({column, prop, order}) {
console.log(column, prop, order);
/*if (column && column.sortable == 'custom') {
this.orderBy = {
orderBy: prop,
sortedBy: order == 'descending' ? 'desc' : 'asc'
}
this.getResults();
}*/
}
}
}
</script>
10 changes: 0 additions & 10 deletions resources/assets/components/views/model/index.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
<style>
.el-table table,
.el-table__empty-block {
width: 100% !important;
}
.fullscreen-v-img {
z-index: 1031;
}
</style>

<template>
<div class="row">
<div class="col-xs-12">
Expand Down
4 changes: 1 addition & 3 deletions src/Contracts/Display/Columns/ColumnInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ public function setMinWidth(int $width);

public function getSortable();

public function enableSortable();

public function customSortable();
public function sortable();

public function enableFixed();

Expand Down
13 changes: 1 addition & 12 deletions src/Display/Columns/Column.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,13 @@ public function getSortable()
/**
* @return $this
*/
public function enableSortable()
public function sortable()
{
$this->sortable = true;

return $this;
}

/**
*
* @return $this
*/
public function customSortable()
{
$this->sortable = 'custom';

return $this;
}

public function isFixed()
{
return $this->fixed;
Expand Down

0 comments on commit f470928

Please sign in to comment.