0

I'm trying to get UI-Grid on my Angular App to filter dates properly but it doesn't seem to respond to any kind of filter change. I've tried going over the docs and using their example:

displayName: "Long Date", cellFilter: 'date:"longDate"', filterCellFiltered:true, 

But nothing seems to change the format of the date, here is my code currently: (updated)

$scope.gridOptionsClaims = {
enableSorting: true,
enableFiltering: true,
showColumnFooter: true,
enableGridMenu: true,
columnDefs: [
{ field: 'date', name: 'Date', displayName: "Date", type: 'date', cellFilter: 'date:"MM-dd-yyyy"', filterCellFiltered: true },
{ field: 'transaction_id', name: 'Purchase Order', displayName: "Purchase Order" },
{ field: 'full_name', name: 'Salesperson', displayName: "Salesperson" }
            ]};

I've tried using filters 'date:MM-dd-yyy' and that didn't work either. Could anyone please tell me what I'm missing?

1
  • You should filter them as dates first in your controller somethiing like: item.date = $filter('date')(item.date, "dd/MM/yyyy"); Commented Mar 15, 2016 at 8:29

1 Answer 1

0

Did you enable filtering with enableFiltering: true property? Also, try to define cellFilter with filters as you already mentioned:

cellFilter: 'date:"yyyy-MM-dd HH:mm"'
Sign up to request clarification or add additional context in comments.

2 Comments

Hi Corry, yes I do have enableFiltering: true turned on for this grid. I updated my code in the original questions to include more information. Thank you for the help!
Did you try to initialize your grid options as $scope.gridOptions = {...} ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.