I have two tables (1) invoice (key is id which is the invoice number) and (2) invoice_details (key is id and invoice_id is a foreign key to invoice).
In the PME for the invoice_details I have the following entries:
$opts['sort_field'] = array('invoice_id', 'id');
$opts['fdd']['id'] = array(
'name' => 'ID',
'select' => 'T',
'options' => 'AVCPDR', // auto increment
'maxlen' => 10,
'default' => '0',
'sort' => true
);
$opts['fdd']['invoice_id'] = array(
'name' => 'Invoice',
'select' => 'T',
'maxlen' => 11,
'required' => true,
'sort' => true
);
$opts['fdd']['invoice_id']['values']['table'] = 'llj_invoice';
$opts['fdd']['invoice_id']['values']['column'] = 'id';
$opts['fdd']['invoice_id']['values']['description']['columns'][0] = 'id';
$opts['fdd']['invoice_id']['values']['description']['columns'][1] = 'inv_dt';
$opts['fdd']['invoice_id']['values']['description']['columns'][2] = 'comments';
$opts['fdd']['invoice_id']['values']['description']['divs'][0] = ' ';
$opts['fdd']['invoice_id']['values']['description']['divs'][1] = ' ';
$opts['fdd']['invoice_id']['values']['filters'] = " delete_flag = 'No' ";
$opts['fdd']['invoice_id']['values']['orderby'] = ' -id ';
My problem is that the List screen for invoice_details is ordered by string rather than by number so invoice 10 is displayed before invoice 2.
Any suggestions for a way around this?
|
Hello All! Newbie here....
When trying to sort my columns by clicking the column header, the data appears to be string sorted instead of numeric. Since I have numbers in these fields, the sort is incorrect.
I noticed the original thread questioned this issue, but there was no resoution.
How do I make the column sort the numeric data properly? I already have the option set as follows on al my numeric fields.
$opts['fdd']['LoanBalance'] = array(
'name' => 'LoanBalance',
'select' => 'N',
'maxlen' => 10,
'default' => '0.00',
'sort' => true,
'total' => sum,
);
Anyone else encounter this problem who may have a solution??
|