The feature to hide columns in Vue-tables-2 seems to be malfunctioning

The issue I'm facing is with the hiddenColumns option not working as expected. Even when I set it to hiddenColumns:['name'], the name column remains visible. I've updated to the latest version, but the problem persists.

UPDATE

I am trying to hide the name column by default while allowing users to unhide it using the columnsDropdown. Simply removing it from the columns array is not an option in this case.

<script>
        new Vue({
            el: '#app',
            delimiters: ['[[', ']]'],
            data: {
                product_list_url: "{% url "api:product-list" %}?source__user_eshop={{ user.get_current_eshop.id }}",
                columns: ['is_active','code', 'name',  'category_full_text', 'brand', 'manufacturer', 'import_price', 'export_price', 'import_export_price_diff', 'on_stock', 'quantity',],
                options: {
                    perPage: 25,
                    perPageValues: [],
                    default: '-',
                    headings: {
                        code: 'Kód',
                        name: 'Názov',
                        on_stock: 'Na sklade',
                        quantity: 'Počet (sklad)',
                        import_price: 'Cena (zdroj)',
                        {#export_price: 'Cena (export)',#}
                        is_active: 'Zobraziť v exporte',
                        category_full_text: 'Kategória',
                        import_export_price_diff: 'Navýšenie',
                        manufacturer: 'Výrobca',
                        brand: 'Značka',
                    },
                    sortIcon: {
                        base: 'fa float-right',
                        is: 'fa-sort',
                        up: 'fa-sort-up',
                        down: 'fa-sort-down'
                    },
                    filterByColumn: true,
                    filterable: ['code', 'name', 'on_stock', 'category_full_text', 'manufacturer', 'brand'],
                    pagination: false,
                    listColumns: {
                        on_stock: [{
                            id: 'true',
                            text: 'Áno',
                        }, {
                            id: 'false',
                            text: 'Nie',
                        },
                        ]
                    },
                    sortable: ['name', 'code', 'quantity', 'import_price', 'category_full_text', 'manufacturer', 'brand'],
                    requestFunction: tablesRequestFunction,
                    responseAdapter: tablesResponseAdapter,

                    templates: {
                        on_stock: 'boolean',
                        is_active: 'boolean',
                        name: 'vue-tables-2-product',
                    },
                    columnsDropdown:true,
                    hiddenColumns:['name'],
                    texts: {
                        count: "Zobrazujem {from} - {to} z {count} záznamov|{count} záznamov|Jeden záznam",
                        first: 'Prvá',
                        last: 'Posledná',
                        filter: "Filter:",
                        filterPlaceholder: "Vyhladať",
                        limit: "Záznamy:",
                        page: "Strana:",
                        noResults: "Nenašli sa žiadne záznamy",
                        filterBy: "Filtrovať",
                        loading: 'Načítavanie...',
                        defaultOption: 'Vyberte {column}',
                        columns: 'Stĺpce'
                    },
                },
            },
            mounted() {
            },
            methods: {
                loading: function (id) {
                    // Animate loader off screen
                    $("#" + id).show();
                },
                onLoaded: function (id) {
                    $("#" + id).hide();
                },
                displayPrice: function (price, suffix) {
                    if (price !== null) {
                        return price + ' ' + suffix;
                    }
                },
                displayDiffPrice: function (price, suffix) {
                    if (price !== null) {
                        if (price < 0) {
                            return this.displayPrice(price, suffix);
                        } else if (price > 0) {
                            return '+' + this.displayPrice(price, suffix);
                        }
                    }
                },
                diffPriceStyle: function (price) {
                    var color = null;
                    if (!((price === null) || (price === 0))) {
                        if (price < 0) {
                            color = 'red';
                        } else if (price > 0) {
                            color = 'green';
                        }
                    }
                    return {color: color}
                }
            },
        })

    </script>

I'm stumped at this point. Any suggestions?

Answer №1

If your version is older than November 2019, it may not work properly according to the latest update from matfish2 on this issue reported on GitHub. I encountered the same problem, but updating to the newest version solved it for me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble grouping data on website due to duplicate names

Currently in the process of scraping data from various websites and looping through it. Specifically focusing on scraping the head section. This is an example illustrating the structure of the data: const head = { rel_data: [ { rel: &quo ...

"JavaScript/jQuery: The pattern in the text does not align with the string

I am currently working on validating a text field with the specific data pattern of "I-MH-ABCD-ABC-1222". Below is the regular expression I have implemented, but unfortunately it is not functioning as intended. var router_added_sap = "I-MH-ABCD-ABC-1222" ...

What is the process for invoking an External Javascript Firestore function within a Typescript file?

Trying to figure out how to integrate a Firestore trigger written in an external JavaScript file (notifyNewMessage.js) into my TypeScript file (index.ts) using Node.js for Cloud functions. Both files are located in the same directory: https://i.stack.imgu ...

Effortlessly update data in real-time using Laravel and vue.js

I am dealing with constantly changing API data in my development work. Utilizing Laravel and Vue.js, I can see a continuous flow of data when monitoring the network using F11. However, this does not seem to have any impact on the DOM. Below are some sampl ...

Tips on adjusting a position that shifts with changes in window size

Working on a website for my grandpa, I'm planning to include a small biker character that runs across the screen. When hovered over, he stops and advises "wear a helmet." The animation works well, but there's an issue with the positioning when th ...

Troubleshooting a Problem with AngularJS $.ajax

Oops! Looks like there's an issue with the XMLHttpRequest. The URL is returning a preflight error with HTTP status code 404. I encountered this error message. Any thoughts on how to resolve it? var settings = { "async": true, "crossDomain": ...

Reorganize the JSON data to match the specified format

{ "EUR": { "Description": "", "Bid": "1.1222", "Region": "", "Bid1": "1.1283", "CurrencyCode": "EUR", "FeedSource": "1", "Ask": "1.1226", "ProviderName": "TEST 1", "Low": "1.1195", ...

Unexpected behavior: JQuery Ajax request not displaying Json object following recent update to JQuery version 1.10.2

Currently facing an issue with a project I am working on. The previous programmer used jquery 1.4.4, and I have updated it to 1.10.2 due to the designer using Bootstrap. However, after running it in version 1.10.2, one of the objects that was functional i ...

Utilizing jQuery's nextUntil() method to target elements that are not paragraphs

In order to style all paragraphs that directly follow an h2.first element in orange using the nextUntil() method, I need to find a way to target any other HTML tag except for p. <h2 class="first">Lorem ipsum</h2> <p>Lorem ipsum</p> ...

Angular 2 Encounter Error When Trying to Access Undefined Property in a Function

Element: import { Component, OnInit } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Component({ selector: 'app-ore-table', templateUrl: './ore-table.component.html', styleUrls: [&a ...

Tips for aligning a select and select box when the position of the select has been modified

Recently, I encountered an interesting issue with the default html select element. When you click on the select, its position changes, but the box below it fails to adjust its position accordingly. https://i.stack.imgur.com/SwL3Q.gif Below is a basic cod ...

A guide on renewing authentication tokens in the Nestjs framework

import { ExtractJwt, Strategy } from 'passport-jwt'; import { AuthService } from './auth.service'; import { PassportStrategy } from '@nestjs/passport'; import { Injectable, UnauthorizedException } from '@nestjs/common&apo ...

Loading content synchronously

Could you assist me in finding a solution to synchronize the loading of pages and elements? Currently, my code looks like this: $(Element).load(File); ... other commands... window.onload = function () { Update_Elements(Class, Content); } Everything ...

Validation of VAT numbers using JavaScript instead of PHP

I came across an interesting function at this link that is used for checking VAT numbers in the EU. However, I am struggling to integrate it with my registration form. I would like to convert it into a JavaScript function so that I can validate the number ...

Navigating through drop-down menus using jQuery

I need help with a JavaScript script that can calculate the total number of points based on selected checkboxes and dropdown values. Currently, my script is able to iterate through checkboxes and assign 1 or 2 points based on their classes, but I'm st ...

JavaScript generating HTML code causing malfunctions

I have been attempting to implement the IN Place Editing feature using JQuery. Below is the code snippet editinplace.js $(document).ready(function() { //When div.edit me is clicked, run this function $("div.editme").click(function() { // ...

Utilizing Ionic for local data retention

Seeking assistance with connecting my app to local storage in order to save data on the user's device without resetting every time the app is closed. Struggling to link local storage to an array of objects. Any guidance would be highly appreciated. Re ...

Displaying iterative content using Vue.js from an array of items

Looking to style questions and answers differently when rendering them. The data structure is as follows: dialogTut:{ mainTab:{ q:"data with 42 people?", a:"hehe", q:"Are awesome people?", a:"sometimes", ...

What steps should I take to resolve a plugin error specifically related to index.js while using Cypress?

I am encountering an error in Cypress A plugin has thrown the following error, causing our tests to stop running due to a plugin crash. Please verify your plugins file (/home/dev2/Desktop/kavitaSeffcon/CypressProject/cypress/plugins/index.js) Error: ENOE ...

The concept of sharing states between components in Vuejs

Seeking advice on the optimal approach for implementing shared states between components in Vuejs. Consider scenario A: a web app displaying a modal with a boolean state show. This state should change when the modal's OK button is clicked, as well as ...