ROW ID Question

ROW ID Question

lyndonwillyndonwil Posts: 40Questions: 5Answers: 0
edited May 2014 in DataTables 1.10

I have a ID field and i'd like it to be the first column in the table. I'd also like it to be the ROW ID

To get the ID field in the first column, I do this :

array( 'db' => 'enquiryid', 'dt' => 0,
    'formatter' => function( $d, $row ) {
        return number_format($d);
    }
)

To get the ROW ID, i do this :

array('db' => 'enquiryid','dt' => 'DT_RowId',
    'formatter' => function( $d, $row ) {
        return 'row_'.$d;
    }
)

My question is, how can I do both at the same time as I need the ID field to be shown in the first column. I.e. 1, 2,3 etc.. and I need the Row Id in the TR. I.e. Row_1, Row_2 etc..

Lynd

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    You could use createdRow to add the row. Or if you need to use the SSP class, you could loop over the data before it is sent back and copy it from over variable to another. Finally, you could use data: 'DT_RowId' for the first column.

    Allan

  • lyndonwillyndonwil Posts: 40Questions: 5Answers: 0

    Thanks Allan, thats great :-)

This discussion has been closed.