Fetch extra columns & have a preset "where" (serverside)

Fetch extra columns & have a preset "where" (serverside)

AlbertMNAlbertMN Posts: 1Questions: 1Answers: 0

Hey there! I have been struggling with getting the serverside DataTables ajax fetch to work like I want it to, and haven't found any documentation on this, so here goes;

I'm using the PHP SSP-class, and I'd like to get more than just the columns that are shown in the table. Fx., one of the (client-side) table columns is status, and the formatted data of this field depends on the value of 3 other columns from the (MySQL)table. the second argument passed to the formatter function in the server-side column setup is $rows, but this only returns the rows represented in dt values in the column-arrays. So, how would I go about getting more columns from the database, without showing them as a column in the HTML-table?

My second issue might just be me not understanding the complex function from the SSP-class, but (no matter what is searched, ordered by and so on), I need to have a standard WHERE statement. The statement is as follows;

printer_id IN (1,2,3,4,5) AND ((started != '0000-00-00 00:00:00' AND ended != '0000-00-00 00:00:00') OR printing = 1)

I have made a very poor attempt to modify the SSP-class, but I'm thinking this must be something that is achievable without modification (maybe?)

Thanks so much in advance!

Answers

  • allanallan Posts: 63,205Questions: 1Answers: 10,415 Site admin

    So, how would I go about getting more columns from the database, without showing them as a column in the HTML-table?

    Just don't configure the DataTable to show them.

    Consider this example (ignore that it is an Editor example - the bit we are interested in doesn't depend on Editor at all).

    The table is configured to show 4 columns, but the data object contains 9 data points for each row (the example uses that with Editor to edit data which is not visible in the table).

    Allan

This discussion has been closed.