PDA

View Full Version : How can I keep old date in grid.



thomsonzh
3 Sep 2013, 6:41 AM
I use grid editor plug in. When I edit an existing row on the grid, the datetime field change to empty.How can I keep the datetime field data?

Any suggestions,many thanks,
Thomson

carol.ext
3 Sep 2013, 2:00 PM
Which grid editor plugin? Does this occur for you with the grid editor examples?

Row Editor current link (http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/grid/row-editing.html)

Cell Editor - Kitchen sink - current link (http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#cell-editing)

thomsonzh
4 Sep 2013, 5:14 AM
Hi Carol,

Thanks for your respond.I found the problem where is. If I use date format like 9/19/2013, it is working well. But I prefer the date time format like 2013-9-19. Please advise it is possible the date format like Y-m-d?

Result picture as below,
Original
45670
Click for edit.
45671
please advise.

Thanks in advance.

carol.ext
4 Sep 2013, 6:52 AM
How have you specified the format/dateFormat for the column renderer, the column editor, and the fields in the model/store? What does the input data look like for the date field ( the json or xml)?

thomsonzh
4 Sep 2013, 8:06 AM
Thanks Carol, your reminder help me fix this issue. In case other guy need it. I post my solution as below, row editor plug in only mind date time format from Jason / xml . I mean the date type form backend should be m/d/y.
So I wrote a sql function for date time convert. Code as below,
ALTER FUNCTION [dbo].[getUSDateFormat](@date varchar(30))
RETURNS varchar(20)
AS
BEGIN
-- Declare the return variable here
DECLARE @usdate varchar(20)
select @usdate=convert(varchar(20),CAST(@date AS DATETIME),101)
RETURN @usdate


END

Cheers,
Thomson