Okay
  Public Ticket #1555565
Hide Column based on selected Column Filter value
Closed

Comments

  •  2
    Paul Desormeaux started the conversation

    Thank you for excellent support!

    Out of 9 columns (A, B,C, D,E, F,G, H,I) I need to display (i.e. dynamically refresh) 3 different sets of columns based on the filter value(s) selected in multi-select Checkbox column A. For example:

    • If column A filter = 1, then display columns (B,C, D,E)
    • If column A filter = 2, then display columns (B,C, F,G)
    • If column A filter = 3, then display columns (B,C, H,I)
    • If column A filter = 1 and 2, then display columns (B,C, D,E, F,G)
    • If column filter = 2 and 3, then display columns (B,C, F,G, H,I)
    • If column A filter = 1 and 3, then display columns (B,C, D,E, H,I)
    • If column A filter = and 2 and 3 (or none), then display all columns

    I don't know JS language, but looking for pseudo-code something like this:

    function DisplayColumnSubset( $jsDef, $columnHeader )
        {
        $jsDef->bVisible = ( $jsDef->origHeader IN {"A","B"} )
        $jsDef->bVisible = ( $jsDef->origHeader IN {"D","E"} ) AND ( Column_A_Filter [array] includes 1 OR None );
        $jsDef->bVisible = ( $jsDef->origHeader IN {"F","G"} ) AND ( Column_A_Filter [array] includes 2 OR None );
        $jsDef->bVisible = ( $jsDef->origHeader IN {"H","I"} ) AND ( Column_A_Filter [array] includes 3 OR None );
        return $jsDef;
       }
    add_filter( 'wpdatatables_filter_column_js_definition', 'DisplayColumnSubset', 10, 2 );
    -- not sure if 'Column_A_Filter [array]' can be accessed from this function ??? --

    BTW: I think this ticket may be close to what I need: Hide Columns

    BTW: I am using Powerful Filters for wpDataTables., which is great at dynamically updating filter values as filters are entered.

    Thank you.

  •  1,784
    Miloš replied

    HI Paul,
    Thank you for your purchase.

    As I understand you want to display the values in the table that are related on the previous value selected in the selectbox, checkbox or multiselect box.

    The Powerful filters have that option.

    Also can you please resend me the link because when I click on it , it does not refer me to any page.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Paul Desormeaux replied

    Hi Bogdan.

    Thank you, but the tricky part here is that I need to only display a subset of columns from (A, B,C, D,E, F,G, H,I) based on what is selected for the column A filter, and hiding the remaining columns. So, for example, if column filter is set to 1, then the table grid should only display columns(B,C, D,E) and hide columns (F,G, H,I).

    Thank you.

  •  1,784
    Miloš replied

    HI Paul,

    Sorry to disappoint you but unfortunately something like this is not possible to achieve with the plugin built in features at the moment and require some code customization of the plugin. If you are interested we can offer you our paid customization service where you can hire one of our developers to implement this feature for you.


    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Paul Desormeaux replied

    Okay, thank you.

    Another option might be to dynamically set the width to 0 pixels or chnage the cell background or text colours. Would that be possible?

    Thank you.

  •  1,784
    Miloš replied

    HI Paul,

    Possible it can be achieved with some changing of the cell background but that depends on table structure. If the table is server side or not.

    Unfortunately due to our support policy and users that have similar requests I can give you the code for this because it is not included in the regular support of the plugin. Included support covers help with bugs and general inquiries for the plugin features, but not writing custom code. As you're developing some custom solution if you need our assistance we can offer you our paid customization service.

    Thank you for understanding.

    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables