| Page 1 of 1 | [ 5 posts ] |
|
Hi,
We are using 2.8 in our application and we are using date and time stamp both on the same page which uses three date column and one date + time column . When we use date format for all the column and apply sorting on those than it works properly but when we try to print the date+ time than date format will still take only the date not the time.So to avoid this we have converted the date format into string and try to print as required but it won't allow use to do sorting on that column.I tried every way but won't find and justified solution on timestamp sorting. Please help me into this context Regards |
|
DataTable assumes that the DataSource will provide all the data in suitable JavaScript native data types, and DataSource is equipped to do this. In the responseSchema.fields array you can either list the name of the field or provide an object with key and parser properties, like:
{key:'someFieldName':parser:'number'} DataSource has a built-in 'date' parser, which uses JavaScript's Date.parse() static function. If your date or time data comes in formats that Date.parse() cannot handle, you have to do your own parser function. The parser property takes either a string with the name of the built-in parser or a function that receives the value to parse and returns it parsed. Once the data is parsed in DataSource, DataTable should have no problem sorting it. |
|
Thanks for the quick reaply satyam... But i did the same and made my own parser and the parser takes string value and returned the value but still am facing the problem.. If you don't mind can you please suggest one code base example so that I can perform in the same way.
Regards |
|
Satyam , I am sorry for the confusion. Let me mention my problem statement again.
I have to display four columns in my DataTable. Out of these four columns three columns should be displayed in format "MM/DD/YYYY" and the fourth column should be displayed in "MM/DD/YYYY HH:MM:SS" format which is a timestamp. My server is sending XML response to DataSource. The response contains values for these columns in their respective required formats like "MM/DD/YYYY" and "MM/DD/YYYY HH:MM:SS". I have applied date parser in my datasource for all four of these columns. I have also used formatter:YAHOO.widget.DataTable.formatDate for these columns in my DataTable. This way sort works perfectly but my timestamp column does not display time portion and just displays date in "MM/DD/YYYY" format. So to display the time portion also, I tried to create my formatter which reads values from Date object and sets el.innerHTML with string having format "MM/DD/YYYY HH:MM:SS". So now using this formatter for timestamp column fixes my display problem but breaks sorting. So please suggest if I am doing anything wrong here or is there is a better way to achieve this. I read that YAHOO.widget.DataTable.formatDate also support customizing date format based on the Locale but I want to display date in multiple formats in different columns in same DataTable. So looks like this is also not the option for me. Thanks. |
|
I don’t think that it could be possible to print on the accurate details. If it was the date format then it only for the printing of the date not including the time. Try to print for the other time that will be sure to sort it while using timestamp.
|
| Page 1 of 1 | [ 5 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group