SixiS / jquery_query_builder-rails

The jQuery Query Builder Rule Evaluator and JavaScript library + Dependencies ready for the Rails Asset Pipeline
MIT License
30 stars 17 forks source link

Including plugins? #1

Closed markmcdonald51 closed 7 years ago

markmcdonald51 commented 7 years ago

Hi,

Thanks for making this gem available. I am trying to use it in my rails app however appear to be getting plugin dependency issues when trying to include in these plugins:

    plugins: [
      'sortable',
      'filter-description',
      'unique-filter',
      'bt-tooltip-errors',
      'bt-selectpicker',
      'bt-checkbox',
      'invert',
      'not-group'
    ],

Below is from the error console within Chrome. I even tried to supplement some of these dependencies by including other gems (which I though might solve the problem) but that didn't work either.

eg: 'gem 'bootstrap-tooltip-rails''

Uncaught Error: Bootstrap Tooltip is required to use "bt-tooltip-errors" plugin. Get it here: http://getbootstrap.com
    at Object.Utils.error (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:2602:15)
    at QueryBuilder.define.placement (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:2840:15)
    at QueryBuilder.<anonymous> (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:138:46)
    at Array.forEach (native)
    at QueryBuilder.initPlugins (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:131:31)
    at QueryBuilder.init (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:386:10)
    at new QueryBuilder (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:22:10)
    at jQuery.fn.init.$.fn.queryBuilder (http://localhost:3000/assets/query-builder.self-42e56373f3d17000e670a448ad4253cb100067f58b40b4c59f6d33e8adde00ad.js?body=1:2721:35)
    at http://localhost:3000/udts/108-kol-1_1/query_builders/new:220:606
Utils.error @ query-builder.self-42e5637….js?body=1:2602
QueryBuilder.define.placement @ query-builder.self-42e5637….js?body=1:2840
(anonymous) @ query-builder.self-42e5637….js?body=1:138
QueryBuilder.initPlugins @ query-builder.self-42e5637….js?body=1:131
QueryBuilder.init @ query-builder.self-42e5637….js?body=1:386
QueryBuilder @ query-builder.self-42e5637….js?body=1:22
$.fn.queryBuilder @ query-builder.self-42e5637….js?body=1:2721
(anonymous) @ new:220

Anyway, thanks for all the work you have done on this and I will try to share any mods I make if they are useful.

Best, Mark

markmcdonald51 commented 7 years ago

Actually, strange thing is, when I don't include the plugins it works (at least with the date) ;) screenshot from 2017-03-07 10-22-06

The next thing I am going to so is create a queries model that will accept this data and format it in a way that I am pass it to Active Record Query Interface. Just curious, have you done anything like this on the backend? Thanks in advance.

-mark

SixiS commented 7 years ago

Hey Mark,

Thanks for the issue! Sorry for only responding now, I missed the message about it. Not sure on that javascript error - I suspect it is some sort of conflict within bootstrap. It seems you came right tho.

For the Active Record Query Interface, I just had Ruby objects to compare, but there is a jQuery Query builder plugin that can convert the rules into SQL select statements: http://querybuilder.js.org/plugins.html#sql-support You could plug the generated statements into Active Record.