jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Date format
Tagged: jquery grid
This topic contains 8 replies, has 3 voices, and was last updated by Peter Stoev 11 years, 12 months ago.
-
AuthorDate format Posts
-
Hi, I tried to set custom date format in DateTime column, and couldn’t work it out. Is there any way ?
Another thing , I can’t see Search option in this forum. It makes real headache to find anything.
Thanks !EDIT : Found Search in Dashboard section.
I should have added that date is taken from MS SQL database , and is in format :
Jul 30 2012 12:04:00:000PM.
I tried several cellsformat dates and nothing works. I would like to have it displayed as
dd-MM-yyyy.
Thanks.
Hi miklosz,
Did you set “type: ‘date'” when you initialized the datafields array of the source object?
Do you use jQWidgets 2.8.1?If you have set the type: ‘date’ of the data field, then please send us a sample which demonstrates your scenario.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/So … it looks like this:
var source =
{
datatype: “json”,
datafields: [
// Jul 30 2012 12:04:00:000PM – it’s like date is sent here
{ name: ‘CompletionDueDate’, type: ‘date’, format: ‘MMM d yyyy HH:mm:ss.fff’},
{ name: ‘ToolReference’},
{ name: ‘CustomerName’},
{ name: ‘CurrentProcess’}
],
url: ‘grid_data.php’,
cache: false
};
I tried several format patterns, nothing works.Json record passed is :
[{“CompletionDueDate”:”Feb 23 2012 09:15:00:000AM”,
“ToolReference”:”11111″,
“CustomerName”:”test1″
,”CurrentProcess”:”P1″}, …And later in grid settings
columns: [
{ text: ‘Due Date’, datafield: ‘CompletionDueDate’, width: 200, cellsformat: ‘d’ },
{ text: ‘Kit No’, datafield: ‘ToolReference’, width: 60},
{ text: ‘Customer Name’, datafield: ‘CustomerName’, width: 230 },
{ text: ‘Process’,datafield: ‘CurrentProcess’,width: 200 }
Whatever cellsformat I set, even stupid one, looks like it’s not read by grid at all.Thanks for any help.
Hi,
I did overcome this issue in completely different way. I process andformat date in grid_data.php file :
$temp_date = date_parse($row[‘CompletionDueDate’]);
$new_date = $temp_date[“day”].’-‘.$temp_date[“month”].’-‘.$temp_date[“year”];And then cellsformat works as required. Hope it might help others.
Thanks anyway,
Is there a way to custom format the date in the columns definition? I wouldn’t like to do what miklosz did…
Thanks,
Hi,
The “cellsformat” column property enables you to specify the Format of the Date. You may learn more about the column’s “cellsformat” in the Grid’s API after expanding the “columns” section. In case you wish to override the rendering of a column, you may use the “cellsrenderer” callback instead which is also per column.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/The cellrenderer works fine. The only thing is that the filter won’t follow the same pattern.
I see in your API (jqxgrid.js) some other formats:
Were they supposed to work?
Thanks!
Hi,
1. Please, do not post code from jqxgrid.js or any other script file as that is in violation with the EULA!
2. You can find the supported formats in the Grid’s API in the columns section.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.