Solved

How to do the Date format in ui-grid

Posted on 2016-09-24
7
56 Views
Last Modified: 2016-11-13
Hi,  I tried this and it is not working for me. Dates are now displayed as 2015-02-03T05:49:54.850Z. Any suggestions plz.
$scope.gridOptions = {
data: 'mydata',
enableRowSelection: true,
multiSelect: false,
enableColumnResize: true,
columnDefs: [
{ field: 'startDate', displayName: 'Date',type: 'date', cellFilter: 'date:\'yyyy-MM-dd\'' }]};

Open in new window



Thanks
0
Comment
Question by:KavyaVS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 23

Assisted Solution

by:Ioannis Paraskevopoulos
Ioannis Paraskevopoulos earned 100 total points
ID: 41814645
Which version of ui-grid are you using?
If you are using the latest, you should also provide a name for each columnDef.

Do you get any errors in the console??

Giannis
0
 
LVL 27

Expert Comment

by:BigRat
ID: 41814664
These are the options for the Grid, the Grid itself will be made (I hope) from an HTML template. Can you post the template? Or are you using a standard grid?
0
 

Author Comment

by:KavyaVS
ID: 41815253
I am using version 3 .In the module declaration I am injecting [ui.grid] .I am not getting any console errors.

I already posted the code I am using for Date formatting.But is is not working. Dates are displaying as 2015-02-03T05:49:54.850Z. But I want it as yyyy-MM-dd with out any time zone,hours,mins etc., Thanks
0
Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

 
LVL 27

Assisted Solution

by:BigRat
BigRat earned 400 total points
ID: 41815835
What do you have as data? The docs say that it must be a Date object, amongst others. But if the Javascript "variable" in the data is a string, then the type must be string and not date.
0
 

Author Comment

by:KavyaVS
ID: 41820363
I tried the type as string. But still not working.
0
 
LVL 27

Accepted Solution

by:
BigRat earned 400 total points
ID: 41841692
I'd really like to see the data source, but I suspect that it is a string. It is very important to know EXACTLY what we are dealing with in order to get the correct filter.

See http://brianhann.com/6-ways-to-take-control-of-how-your-ui-grid-data-is-displayed/ for example!
0
 

Author Closing Comment

by:KavyaVS
ID: 41885324
Thanks
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question