Grid.MVC date filter

别来无恙 提交于 2019-12-22 18:27:45

问题


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:

  1. bootstrap.min.js
  2. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!