mistic100 / jQuery-QueryBuilder

jQuery plugin offering an interface to create complex queries
https://querybuilder.js.org
MIT License
1.68k stars 552 forks source link

Class attribute to radio inputs #95

Closed umneeq closed 9 years ago

umneeq commented 9 years ago

Can you add ability for adding class attributes to radio inputs? This feature would be very helpful. For exmaple, I have iCheck plugin that converts my radio and checkbox inputs to pretty look, but it adds a parent div to inputs and after that buttons "AND" and "OR" become inoperative. If I would have an ability to add class for this inputs I can turn off iCheck plugin (and maybe other plugins) to operate with them specifying the desired class. Sorry for my English. Thank you.

mistic100 commented 9 years ago

input[type=radio]:not(.query-builder .group-conditions input) no need for extra class demo: https://jsfiddle.net/j455zq6y/2/


other solution : input[type=radio]:not([name$=_cond]) (more conflicts possible)

(seriously, stop apologies for english, not one cares on such international website ;-) )

umneeq commented 9 years ago

Not working for me.

mistic100 commented 9 years ago

don't expect any help if you don't show what you did

I added this at the end of the example page (+ imports) and it works

$('input:not(.query-builder input)').iCheck({
  checkboxClass: 'icheckbox_minimal',
  radioClass: 'iradio_minimal'
});
mistic100 commented 9 years ago

feedback ?

if you really need to add classes you can overwrite the template method

$('#builder').queryBuilder({
  template: {
    group: myGroup
  }
});

where myGroup is a modified version of https://github.com/mistic100/jQuery-QueryBuilder/blob/1.4.2/src/query-builder.js#L1388-L1426

(this is not documented because the template is likely to change between versions and break customizations)