Okay
  Public Ticket #995847
How to rename values
Closed

Comments

  •  2
    Frank started the conversation

    How to rename values for display only, e.g. replace INT value 1 in database with 'yes' in datatable, INT value 0 in database with datatable 'no'? 

    Or VARCHAR value NULL in database with datatable - (dash)?

  •  1,825
    Miloš replied

    Hi Frank,
    Thank you for your purchase.

    I can suggest you to use this filter exactly for mysql

    wpdatatables_filter_mysql_query( $query, $table_id )

    This filter is applied to the MySQL query before it is sent to MySQL server. $query is the query text, $table_id is the table identifier from the MySQL table (wp_wpdatatables).

    Also take a look at this documentation where you can find some useful filters which can be defined by user.  We have also have documentation about actions so I suggest you to take a look at this too.
    Here is a video where you can see how to use them. I hope you can find what are you trying to achieve.

    Example:

    You can change the possible values to 0 and 1 for example select box or checkbox filter and then using jQuery change text of these filter values from 1 to Yes and from 0 to No.

    You can do this using jQuery text() function. Just change Selecter from this example with your filters selecter:

    ('#table_1 > tfoot > tr > td.header.sort._newcolumn_1 > span > div > div > span.selecter-item.selected').text('Yes');

    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