Problem with Toggle Buttons

Problem with Toggle Buttons

Mauro26Mauro26 Posts: 17Questions: 7Answers: 0

Hi everyone,
I'm having some problems with the ToggleButtons, the problem is that i have some hidden columns and some columns that are going to appear regarding the user role.
A superUser is going to have 16 columns meanwhile a normal user is going to see only 10. This changes all the time my index so i cannot do this anymore

          "buttons": [{
                "extend": 'columnsToggle',
                "columns": [2, 6, 8, 10]
            }],

example of the columns:

#if($bHasAuthFinance)
                    { "sTitle": "$!strTotalVal",    "sClass": "thsorting thcentered tdright", "iDataSort": 7, "bExport": true},##5
                    { "sTitle": "$!strTotalVal",    "sClass": "thcentered tdright", "name": "sapAmount", "sCol": "SapAmount", "bVisible": false, "bSearchable":true, "bExport": false },##5

                    #if($bHasAuthShop)
                    { "sTitle": "$!textPrint", "sClass": "tdcentered", "bSortable": false, "bSearchable":false, "bExport": false }, ##2
                    #end
                #end

if i use the columnsToggle without specify any column then it will shown all columns okey but the problem is that it shows my not visible columns, i have some columns that are hidden and they don't suppose to see them.

Any idea how can i show only the buttons of the columns that don't have the Visible: false button i want that it doesn't show the button.
I tried to use classes but it doesn't work aswell

Thanks in advance!!

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @Mauro26 ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • Mauro26Mauro26 Posts: 17Questions: 7Answers: 0

    I only want to know which ones would be the options in this case. But then is okey, i'm not going to make a whole example when i'm just asking a simple question.
    I will ask in another page.

    Cheers,

    Raul

  • kthorngrenkthorngren Posts: 21,327Questions: 26Answers: 4,949
    edited July 2019

    The purpose of the example is not to replicate your environment but to build a simple example of what you want to do. This way we can offer help specific to what you are trying to do. Here is a simple example of using classes to control the toggle buttons:
    http://live.datatables.net/joxunowo/1/edit

    Just change var showPos = false; to true to see a different result. The column-selector option is used as a function. There is an example of using a function in the docs.

    HTH,

    Kevin

This discussion has been closed.