Doubt about server side script

Doubt about server side script

E_BrandaoE_Brandao Posts: 12Questions: 5Answers: 0

I have a table with one column filled with numbers from 1 to 3. I want my server script to do some treatment so that 1 appears in the table as "Create", 2 appears as "Remove" and 3 appears as "Edit", how do I do this?

This question has an accepted answers - jump to answer

Answers

  • rf1234rf1234 Posts: 2,949Questions: 87Answers: 416
    edited June 2020 Answer ✓

    Since you are not mentioning whether or not you are using Editor nobody will be able to tell you. It depends! So please describe your problem in more detail and post a test case as per the forum rules.

    So let's assume you use Editor and let's assume you are using PHP then this should be helpful:
    https://editor.datatables.net/manual/php/formatters

    Field::inst( 'action' )
        ->getFormatter( function ( $val, $data ) {
             if ( $val == 1 ) {
                return "Create";
             }
            if ( $val == 2 ) {
                return "Remove";
            }
            return "Edit";
        } )
    
  • E_BrandaoE_Brandao Posts: 12Questions: 5Answers: 0

    Sorry, i I formulated badly the question, but that is exactly what you assumed, thanks

This discussion has been closed.