QueryBuilder中的datepicker插件出现问题

时间:2019-04-16 12:34:34

标签: javascript datepicker query-builder

我正在使用QueryBuilder,并且搜索的类型为date。问题是由于插件数据选择器而出现错误,但是我不知道该错误的原因是什么,有人可以帮助我吗?

我的代码:

        {
        id: 'pac_dt_validate',
        label: 'Data Validade',
        type: 'date',
        operators: ['equal', 'less', 'less_or_equal', 'greater', 'greater_or_equal', 'between'],
        validation: {
          format: 'dd/mm/yy'
        },
        plugin: 'datepicker',
        plugin_config: {
          dateFormat: 'dd/mm/yy',
          dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado'],
          dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
          dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
          monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
          monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
          nextText: 'Próximo',
          prevText: 'Anterior',
          todayBtn: 'linked',
          todayHighlight: true,
          autoclose: true
        }


    <script src="{{ asset('vendor/adminlte/vendor/jquery-builder/js/query-builder.standalone.min.js') }}"></script>    
    <script src="{{ asset('vendor/adminlte/vendor/jquery-builder/query-builder.pt-BR.js') }}"></script>                
    <script src="{{ asset('vendor/adminlte/vendor/momentJs/moment-with-locales.min.js') }}"></script>  

Bootstrap Js已经导入,所以这不是问题,出现的错误是这样的:

Uncaught TypeError: n[i.plugin] is not a function
at c.createRuleInput (query-builder.standalone.min.js:7)
at c.updateRuleFilter (query-builder.standalone.min.js:7)
at n.update (query-builder.standalone.min.js:7)
at n.dispatch (jquery.js:2)
at n.y.handle (jquery.js:2)

有人可以帮助我吗?预先谢谢你。

1 个答案:

答案 0 :(得分:1)

您需要导入bootstrap-datepicker.js。请记住,此导入需要在bootstrap.js导入之后进行。

在那之后,您将需要导入bootstrap-datepicker.css来设置插件的样式