Bajju
Bajju

Reputation: 935

Grid.MVC date filter

I have a model bound to grid.MVC, every other filter works fine apart from the date picker filter.

I have added the grid.mvc.datepicker.css to the bundle and I am getting the date picker.

enter image description here

There are no errors in any of the js and all the js files load properly

And this is how I initiate the column in the view

columns.Add(o => o.VoucherType.Expiry)
    .Titled("Expiry")
    .SetFilterWidgetType("")
    .Format("{0:dd/MM/yyyy}");

When I click on the date , nothing happens to the grid.

Upvotes: 2

Views: 3738

Answers (2)

Kyle Bachmann
Kyle Bachmann

Reputation: 326

The problem is not that you have forgotten to add the bootstrap.min.js or the bootstrap-datepicker.js but that you have not added the CSS file to the _Layout partial of your application.

I had this problem too, when I installed Grid.MVC the javascript got put in the right place, but I forgot to look in my /Content/ folder and drag the gridmvc.datepicker.min.css file onto my _Layout. After I did that it rendered fine.

I hope this solves your problem.

Upvotes: 2

Shadowind
Shadowind

Reputation: 114

I was able to reproduce the problem you are experiencing.

Since Grid.MVC is based on bootstrap you need to include the following bootstrap scripts in your solution:

  1. bootstrap.min.js
  2. bootstrap-datepicker.js.

I reproduced your problem by removing the bootstrap-datepicker.js from my solution includes.

Thank you

Upvotes: 1

Related Questions