问题
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.

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.
回答1:
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.
回答2:
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:
- bootstrap.min.js
- bootstrap-datepicker.js.
I reproduced your problem by removing the bootstrap-datepicker.js from my solution includes.
Thank you
来源:https://stackoverflow.com/questions/30837665/grid-mvc-date-filter