Closed GoogleCodeExporter closed 9 years ago
why has your srcformat and the newformat the same value?
the srcformat specify the date in your JSON result and newformat
is the date you want to see.
Original comment by johgep
on 4 Mar 2010 at 6:39
My server date is in the form dd-mm-yyyy(which is returned in my JSON result) &
I
want to display on screen dd-mm-yyyy. So that is why I put the srcformat the
same as
the newformat(in hind sight maybe this is redundant). If I dont put the
formatoptions in my grid column, the date does display as per my JSON result.
Which
is good.
However, when I try to add a new record or edit an existing one, If I input my
date
as dd-mm-YYYY I get the error "Please, enter valid date value - Y-m-d".
What can I do in my gridColumn so that dd-mm-YYYY can be accepted as a valid
date
value?
Original comment by ramfrombo@gmail.com
on 4 Mar 2010 at 12:09
try it this way:
<sj:gridColumn
name="date"
index="date"
title="Date"
formatter="date"
formatoptions="{newformat : 'd.m.Y', srcformat : 'Y-m-d
H:i:s'}"
width="90"
/>
Original comment by johgep
on 4 Mar 2010 at 12:42
I tried your suggestion but I still cannot save any date other than in Y-m-d
format.
With your suggestion the date is formatted on display of the row properly in
d.m.Y.
However, when I modify the date (still in the d.m.Y format), I get the same
error as
mentioned before.
Is it possible that if the plugin had a datefmt option that we can set in a
column,
then this might override what is in jqgrid(Y-m-d) & work?
Original comment by ramfrombo@gmail.com
on 4 Mar 2010 at 5:53
Original comment by johgep
on 22 Mar 2010 at 12:23
has anyone got an example then of how I can use a column of type date to accept
the
format dd-mm-yyyy?
since my software is being sold in europe, it is imperative that I can use this.
Please help.
Thank you.
Original comment by ramfrombo@gmail.com
on 23 Mar 2010 at 11:30
This sample works great in my case.
<sj:gridColumn
name="processingDate"
index="processingDate"
title="Datum"
formatter="date"
formatoptions="{newformat : 'd.m.Y H:i', srcformat : 'Y-m-d
H:i:s'}"
sortable="true"
width="90"
search="true"
searchoptions="{sopt:['eq','ne','lt','gt'],
dataInit:datePick, attr:{title:'Verarbeitungsdatum'}}"
/>
srcformat is the date format from JSON Result, I think this should the same in
your
case.
newformat is the display format what i want.
Original comment by johgep
on 24 Mar 2010 at 7:03
I have tried your code exactly as you suggested and it does format the date for
display as I want(dd.mm.yyyy).
However when I try to create a new record/edit the date and if I input the date
in
dd.mm.yyyy, when I submit I get an error saying that it must be in the format
Y-m-d.
Do I need to have a specific function to convert date entered in dd.mm.yyyy to
Y-m-d
so that I dont get this jqgrid error message?
In your application, can you add a new date in this newformat?
& submit ok to the server.
Original comment by ramfrombo@gmail.com
on 24 Mar 2010 at 10:11
This issue that I am facing, could this have anything to do with the locale
settings
that jquery uses? displaying works but not adding/editing... anyone with any
help on
this?
Original comment by ramfrombo@gmail.com
on 26 Apr 2010 at 11:48
I wonder is it an issue with the editoptions where I use this:
editoptions="{size: 10, maxlength: 10, dataInit: function(element) {
$(element).datepicker({dateFormat: 'dd-mm-yy'}) } }"
editrules="{required:false, date:true}"
Original comment by ramfrombo@gmail.com
on 26 Apr 2010 at 11:51
Hi Johannes
I believe that if the datefmt option is available for the column properties in
the
plugin, it will allow dates to be successfully saved in the format specified by
the
user.
Please see this link:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
colmodel properties:
datefmt - Governs format of sorttype:date (when datetype is set to local) and
editrules {date:true} fields. Determines the expected date format for that
column.
Uses a PHP-like date formatting. Currently ”/”, ”-”, and ”.” are
supported as date
separators. Valid formats are:
y,Y,yyyy for four digits year
YY, yy for two digits year
m,mm for months
ISO Date (Y-m-d)
Since we cannot set datefmt, it means that it will always use the ISO Date
default
of Y-m-d which explains why I cant edit a date to my own format of dd-mm-YYY.
Awaiting your opinion on this matter.
thanks
Original comment by ramfrombo@gmail.com
on 27 Apr 2010 at 12:03
Hello,
problem is maybe in different format options for gridColumn and datepicker?!
I solved this problem, when I deleted formatter="date". Now it works good:
e.g.
<sjg:gridColumn name="birthday" index="birthday" title="Birthday"
editable="true" edittype="text" editrules="{required:true, date:true}"
editoptions="{dataInit:function(element){ $(element).datepicker({dateFormat:'d.m.yy'}) }}"
formatoptions="{newformat:'d.m.Y'}"/>
Original comment by robert.s...@gmail.com
on 21 Apr 2011 at 1:29
I was also facing the same problem but it was resolved when changed the
editrules="{required:true, date:true}" instead of editrules="{required:false,
date:true}", but removing the formatter="date" will cause problems.
Hi johgep what is the correct way to make the changeyear true in the edit and
add option ?
i have included $(element).datepicker({changeYear:'true'}); in the function but
not working its showing the current month and for fields like date of birth its
hard to navigate to a partricular year as it requires number of clicks.
Original comment by raji.san...@gmail.com
on 4 Aug 2011 at 10:14
Hi i got the issue resolved.. it was because true was surrounded with single
quotes, agn i could only get the years from 2000,but its all because i am new
to this
Original comment by raji.san...@gmail.com
on 4 Aug 2011 at 12:02
Original issue reported on code.google.com by
ramfrombo@gmail.com
on 3 Mar 2010 at 10:39