Add column values based on data retrieved conditions

Add column values based on data retrieved conditions

jigar311982jigar311982 Posts: 70Questions: 31Answers: 0

Hello,

I have a question on column data show based on condition,
I am using server-side rendering and below is the column structure

HTML

                <tr>
                    <th></th>
                    <th>Customer</th>
                    <th>Invoice Number</th>
                    <th>Payment Amount</th>  
                    <th>Payment Date</th>
                    <th>Reference</th>
                    <th>Via</th>                               
                </tr>

JS

            columns: [
                {data: 'payment_id'},
                {data: 'customer_firstname'},  // Show value based on data available
                {data: 'invoice_number'},
                {data: 'payment_amount'},
                {data: 'payment_done_date'},
                {data: 'payment_transaction_number'},
                {data: 'paymentoption_type'},
            ],

Now in server response from the database, there are few rows that have values customer_firstname and some have customer_firstname_advance. Either of one is available, both not at the same time.

Now I want to show whatever available value in Customer column,

How can I show that? any condition before data enters to the column?

Answers

This discussion has been closed.