webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
795 stars 272 forks source link

Date format #72

Closed Fgauth closed 7 years ago

Fgauth commented 9 years ago

How to change date format? currently date format is 14 aug 2014 with "aug" to august. Il want a french date format -> 14 août 2014 with août to august.

thenderson commented 9 years ago

I had a similar problem. EditableGrid only recognizes two possible date formats -- "US" and "EU". I wanted another format, but couldn't get it to 'stick,' no matter what I tried. Then, I noticed that the function 'checkDate' enforces either the US or EU date format. I solved it by overloading a 'neutered' version of the checkDate function in my own JS:

/**
 * Overloading the default checkDate function in order to neuter it.
 */
EditableGrid.prototype.checkDate = function(strDate, strDatestyle) {
    return { 
        formattedDate: strDate,
        sortDate: strDate,
        dbDate: strDate 
    };
};
fredflyer commented 8 years ago

Hello, I also have a format date problem. The date in the cell is like 15 Aug 2015. when i click in the cell to edit, the format is 15/08/2015 I would like to keep this format dd/mm/yyyy in the output (not edit mode). how can i do that ? i did try many things with invocation of methods, but i had an error message on DateCellEditor that has no method init... editableGrid.setCellEditor("madate",DateCellEditor("dd/mm/yy")); editableGrid.setCellRenderer("madate", DateCellRenderer());

I want to be able to use a datepicker aswell, but could not find how to do (of course i have jquery 1.6.4.min.js included). anybody had done that ?

thank you for your help

webismymind commented 8 years ago

Hello,

1/ Make sure that your column has the type "date". The library will then use the right cell renderer and editor.

2/ If you don't want the standard formatting as 15 Aug 2015, just explicitly set the basic CellRenderer (otherwise the DateCellRenderer will be used since this is a "date" column, as said above):

editableGrid.setCellRenderer("madate",  new CellRenderer());

3/ The date picker should work out of the box if jQuery UI is included.

NicksMacLife commented 8 years ago

Not sure about about the first Part. I do know that the date picker is already there if you use chrome.

Sincerely,

Nicholas Ruebel

Sent from my iPhone 6 Plus

On Oct 29, 2015, at 10:09 AM, fredflyer notifications@github.com wrote:

Hello, I also have a format date problem. The date in the cell is like 15 Aug 2015. when i click in the cell to edit, the format is 15/08/2015 I would like to keep this format dd/mm/yyyy in the output (not edit mode). how can i do that ? i did try many things with invocation of methods, but i had an error message on DateCellEditor that has no method init... editableGrid.setCellEditor("madate",DateCellEditor("dd/mm/yy")); editableGrid.setCellRenderer("madate", DateCellRenderer());

I want to be able to use a datepicker aswell, but could not find how to do (of course i have jquery 1.6.4.min.js included). anybody had done that ?

thank you for your help

— Reply to this email directly or view it on GitHub.

fredflyer commented 8 years ago

Hi, the data is date type can't fix the format problem and the datepicker doesn't open. maybe due to the framework i'm using...Intel XDK with app_framework

i'm developping under Linux Ubuntu, and use chromium for testing.

Even trying the example editablegrid-master/examples/jsdata/index.html, the comportment is exactly the same with chrome under windows seven...

Fred