Problem OrderMask with datetime

Discuss MySQL Ajax Table Editor

Problem OrderMask with datetime

Postby quinn » Mon Feb 24, 2014 8:40 am

Hi, :)

i have a problem with the order mask. When i click the column to order, nothing happens.
I format the datetime column to a german date format and change the order_mask as in examples of the mate site.
Like this:

Code: Select all
$tableColumns['datetime'] = array('display_text' => 'Datum', 'perms' => 'TVQSXO', 'display_mask' => 'date_format(datetime,"%d.%m.%Y %H:%i:%s")', 'order_mask' => 'date_format(`datetime`,"%Y-%m-%d %T")');


I also test change the column to the hire_date. But also the same problem. So i think it is not the name of the column.

In Firefox and Chrome you can see the html url/link in the bottom of the window
ordermask.png
order mask
ordermask.png (2.65 KiB) Viewed 10205 times

After the column the statement is truncated

Can someone help me with this problem!?
quinn
 
Posts: 2
Joined: Mon Feb 24, 2014 7:54 am

Re: Problem OrderMask with datetime

Postby admin » Wed Feb 26, 2014 5:00 am

What version are you using? Do you have a link you can share?
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Problem OrderMask with datetime

Postby quinn » Wed Mar 19, 2014 7:56 am

Sorry for the late answer.
I had to quickly find a solution and have therefore decided to use a workaround.

I wrote a callback function that formats my date column before display. This leaves the date format in the sql statements in the database standard and there are no problems. I hope there are no major performance loss on the client side.
quinn
 
Posts: 2
Joined: Mon Feb 24, 2014 7:54 am

Re: Problem OrderMask with datetime

Postby admin » Tue Mar 25, 2014 3:49 am

Because you are only formatting the date for the number of records that are displayed on the page, the performance hit is not much of an issue.
admin
Site Admin
 
Posts: 1502
Joined: Fri Jul 11, 2008 1:34 am

Re: Problem OrderMask with datetime

Postby zelia » Tue Feb 13, 2018 3:32 pm

Hello,
quinn doesn't say what he did. So just in case somebody came here looking for an answer....

In my db dates are stored in the format YYYY-MM-DD. I used php's substr()-function to change the order to this format: DD-MM-YYYY. First I added a call to a new function named fixDate:

$tableColumns['paymentdate'] = array(
'display_text' => 'Date of payment',
'perms' => 'VXQSHT',
'table_fun' => array(&$this,'fixDate'),
'view_fun' => array(&$this,'fixDate')
);

function fixDate($col,$val,$row,$instanceName)
{
$dateTxt = '';
$dateTxt = substr($val, -2) . substr($val, 4, 3) . "-" . substr($val, 0, 4);
return $dateTxt;
}
zelia
 
Posts: 3
Joined: Sun Jan 28, 2018 3:19 pm


Return to Open Discussion

Who is online

Users browsing this forum: Bing [Bot] and 5 guests

cron