guttorm
Junior Member
Posts: 2
Registered: 2/22/2007
Location: Norway
Member Is Offline
|
| posted on 2/22/2007 at 02:50 PM |
|
|
Date formatting of columns very slow.
Hi
I was using date formatting of a column, like this
{
'name': 'NorwegianNameOfColumn',
'type': DATE,
'format_input': 'Y-m-d H:i:s',
'format_output': 'd/m/Y H:i'
}
The dates are then formatted to a format we use in Norway.
But the problem is, having about a 2800 rows in a table, the Javascript took too long. After a few seconds, the browser came up with a message asking
if I want to terminate the script or let it continue. I clicked continue 3-4 times before it was finished.
So I changed it to
{
'name': 'NorwegianNameOfColumn',
'type': STR
}
Now the page loads instantly. But the dates are like they are in the database. I can convert to a Norwegian format on the server very fast, but then
sorting by date gets messed up.
Is there a better solution to this problem?
|
|
|
tigra
Administrator
Posts: 1926
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 2/22/2007 at 08:22 PM |
|
|
Maybe if the format filters were hard coded the conversion would work faster, but this requires the modification of the script's code. Please submit
a support ticket with the customization request if you're interested in getting the quote.
|
|
|
guttorm
Junior Member
Posts: 2
Registered: 2/22/2007
Location: Norway
Member Is Offline
|
| posted on 2/23/2007 at 11:47 AM |
|
|
Hi
Thank you, but I don't think hardcoding will be neccessary. I guess we can live with dates in the database format.
But I have a feature request for future versions. I looked in my Javascript book, and found it has a system for date handeling. Maybe add a column
type "JSDATE" or something?
In the data array, I could then just add something like
new Date(year,month,day,hours,minutes,seconds,ms)
or
new Date(dateString)
or
new Date(milliseoncs)
For outputting the date, maybe a simple call to Date.toLocaleString()?
I think this would be a lot faster than how the date formatting is done now.
|
|
|
tigra
Administrator
Posts: 1926
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 2/23/2007 at 08:40 PM |
|
|
We do use Date object to sort the values. But we need to convert the string to Date object first (that's what new
Date(year,month,day,hours,minutes,seconds,ms) does) so it can be compared with others, then we need to generate the string again. This is what takes
time.
|
|
|
brotherjames
Junior Member
Posts: 4
Registered: 3/9/2007
Location: Missouri
Member Is Offline
|
| posted on 3/10/2007 at 03:09 AM |
|
|
Norwegian Date Formatting
Just a thought is there a way that you can create a View at the the Server level that uses the server to do the date reformatting and you just
reference the view as a table?
|
|
|
tigra
Administrator
Posts: 1926
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/10/2007 at 06:37 AM |
|
|
The thing is that we want to keep it pure client side script. With all the data pushed back and forth it defeats the purpose.
|
|
|