Bugzilla – Attachment 147904 Details for
Bug 33066
We need a KohaTable Vue component
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33066: Add colvis
Bug-33066-Add-colvis.patch (text/plain), 3.82 KB, created by
Jonathan Druart
on 2023-03-08 12:26:05 UTC
(
hide
)
Description:
Bug 33066: Add colvis
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-08 12:26:05 UTC
Size:
3.82 KB
patch
obsolete
>From 1783567dae199216e9f71d92206cafe794b30a3c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 24 Feb 2023 17:08:58 +0100 >Subject: [PATCH] Bug 33066: Add colvis > >--- > .../prog/js/vue/components/KohaTable.vue | 58 ++++++++++++++++++- > 1 file changed, 55 insertions(+), 3 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >index 5f93005108a..e334c405fce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue >@@ -15,11 +15,21 @@ import DataTablesLib from "datatables.net" > import "datatables.net-buttons" > import "datatables.net-buttons/js/buttons.html5" > import "datatables.net-buttons/js/buttons.print" >+import "datatables.net-buttons/js/buttons.colVis" > DataTable.use(DataTablesLib) > > export default { > name: "KohaTable", > data() { >+ let hidden_ids, included_ids >+ ;[hidden_ids, included_ids] = _dt_visibility( >+ this.table_settings, >+ this.options >+ ) >+ let buttons = _dt_buttons({ >+ included_ids, >+ table_settings: this.table_settings, >+ }) > return { > data: [], > tableColumns: this.columns, >@@ -34,9 +44,11 @@ export default { > url: typeof this.url === "function" ? this.url() : this.url, > ..._dt_default_ajax({ options: this.options }), > }, >- buttons: _dt_buttons({ table_settings: this.table_settings }), >+ buttons, > default_search: this.$route.query.q, > }, >+ hidden_ids, >+ included_ids, > } > }, > setup() { >@@ -49,7 +61,6 @@ export default { > }, > beforeMount() { > if (this.actions.hasOwnProperty("-1")) { >- let actions = this.actions["-1"] > this.tableColumns = [ > ...this.tableColumns, > { >@@ -78,10 +89,47 @@ export default { > }, > ] > } >+ >+ $( >+ ".dt_button_clear_filter, .columns_controls, .export_controls, .dt_button_configure_table" >+ ).tooltip() >+ >+ if (this.add_filters) { >+ this.options.orderCellsTop = true >+ } >+ >+ if (this.table_settings) { >+ if ( >+ this.table_settings.hasOwnProperty("default_display_length") && >+ this.table_settings.default_display_length != null >+ ) { >+ this.options.pageLength = >+ this.table_settings.default_display_length >+ } >+ if ( >+ this.table_settings.hasOwnProperty("default_sort_order") && >+ this.table_settings.default_sort_order != null >+ ) { >+ this.options.order = [ >+ [this.table_settings.default_sort_order, "asc"], >+ ] >+ } >+ } > }, > mounted() { >+ let dt = this.$refs.table.dt() >+ let table_node = dt.table().node() >+ if (this.add_filters) { >+ _dt_add_filters(table_node, dt) >+ } >+ >+ dt.on("column-visibility.dt", function () { >+ _dt_on_visibility(this.add_filters, table_node, dt) >+ }) >+ .columns(this.hidden_ids) >+ .visible(false) >+ > if (Object.keys(this.actions).length) { >- const dt = this.$refs.table.dt() > const self = this > dt.on("draw", () => { > const dataSet = dt.rows().data() >@@ -137,6 +185,10 @@ export default { > type: String, > required: false, > }, >+ add_filters: { >+ type: Boolean, >+ required: false, >+ }, > }, > } > </script> >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 33066
:
147352
|
147353
|
147354
|
147692
|
147693
|
147694
|
147713
|
147846
|
147847
|
147848
|
147849
|
147850
|
147851
|
147852
|
147853
|
147855
|
147856
|
147857
|
147858
|
147862
|
147865
|
147902
|
147903
|
147904
|
147905
|
147906
|
147907
|
147908
|
147909
|
147910
|
147911
|
147912
|
147913
|
147914
|
147915
|
147916
|
147917
|
147918
|
147921
|
147922
|
147923
|
147925
|
147926
|
147928
|
147957
|
147960
|
147971
|
147972
|
148718
|
149158
|
149159
|
149160
|
149161
|
149162
|
149163
|
149164
|
149165
|
149166
|
149167
|
149168
|
149169
|
149170
|
149171
|
149172
|
149173
|
149174
|
149175
|
149176
|
149177
|
149178
|
149179
|
149180
|
149181
|
149182
|
149183