How to get 2 fields in ssp class ?

How to get 2 fields in ssp class ?

kiklookikloo Posts: 5Questions: 2Answers: 0

Hi,

I am using ssp class to get the data using json etc. and it works fine. I have a tiny problem as to how to get 2 fields in 1 array in the ssp file. For example:

    array(
        'db'        => 'prod_status',
        'dt'        => 8,
        'formatter' => function( $d, $row ) {
        if($d == 0) { return "Invisible"; } else { return "Visible"; }
        }
    ),

As you can see i am only able to get the prod_status field's data in that, I want to get another fields data say: prod_id also in it. What I have to do to get both prod_id and prod_status in that ?

Thanks.

Answers

  • gyrocodegyrocode Posts: 126Questions: 6Answers: 30
    edited March 2020

    Do you mean that you want to access prod_id in the formatter function? If yes, you can access it using $row variable, for example $row['prod_id']. If no, please explain.

    If you want to return prod_id in the response, then just include the following definition.

    array(
        'db' => 'prod_id',
        'dt'  => 9
    ),
    

    See more articles about jQuery DataTables on gyrocode.com.

This discussion has been closed.