In order to generate an export CSV button we need to use the option type "X" on View tables.
$QUOTES->setOption("VIEW QUOTES,VER COTIZACIONES,VOIR SOUMMISSIONS","aside","3","VLX");
Or manually we can add the option "xcel" to true
$options['form'] = false; $options['view'] = true; $options['xcel'] = true;
When generating a CSV is strongly recommended not to use the all (*) option on our Select Queries, as this will download all the columns from the table, and it will not match the view in KAS, instead select each column required, it a table name needs to be specified due to a JOIN, always rename the columns with "as"
$query = "SELECT $dbtable.QID as QID, $dbtable.transaction_date as date, $dbtable.transaction_description as description, $dbtable.transaction_amount as amount, $dbtable.transaction_currency as currency, QUOTES.transaction_id as transaction_id FROM $dbtable LEFT JOIN QUOTES on $dbtable.QID = QUOTES.QID
Keep in that the export button will ONLY generate the limit shown on the screen, so you might want to increase the limit to a values that most of the times will include all the results.
//option type "N" variables (numbered result pages) $limit = 500;
Finally, if some columns are required for the Table View but you want to exclude them form the export, then use the $csvexclude variable, separate the values by commas.
For example, may times the ID of the db_table is required for the Table View edit and delete options to work, but you want to exclude that information from the CSV:
For example, may times the ID of the db_table is required for the Table View edit and delete options to work, but you want to exclude that information from the CSV:
$csvexclude = "QID,transaction_id";