-
Notifications
You must be signed in to change notification settings - Fork 558
Description
Hello @mistic100. Thank you for this awesome QueryBuilder plugin. I work at Yahoo and I want to get your thoughts on the following.
We use a fork of the QueryBuilder internally for a couple of our tools. The fork is mainly because we had to add support to show a subfield for filters (i.e. filters are not just a select dropdown and depending on the value of a particular item, an extra text input is shown whose value the user enters and qualifies the filter). We have tried to abstract it into the plugin model and while we were successful, the numerous touch points that this change creates, renders the existing events system insufficient in accommodating all of them.
While we were able to use the events system for a lot of them, for others we had to do some hacky stuff to get around this (Disclaimer: the developers who worked on this are also not Javascript experts and learnt it recently). This includes wrapping original function calls in QueryBuilder by saving a reference to them, overriding them, doing our custom stuff and calling the original methods inside the overridden methods. This is in order to not touch the original QueryBuilder code. It is also inefficient (iterating over the model more than once) because of that. Some of these methods are:
getRules, setRules, addRule, updateRulefilter, updateRuleOperator
An example of what I mean by "wrap" the original code:
setRules : function(data) {
this.modify(data);
originalSetRules.call(this, data);
this.modifyModel(this.model.root);
}
There are also other minor changes in the fork such as modifying the sql plugin to accommodate the new subfield (by adding new events to the sql plugin)
The reason I am reaching out to you is because we want to open source the tool that uses the modified QueryBuilder plugin in its UI. This means that we'd need this modified QueryBuilder also open sourced. Do you think there is a need for the subfield plugin in QueryBuilder? If so, to do it properly, we'll need at least more events that lets the plugin developer have more control over what goes in and out of the methods listed above. Are you interested in having this in QueryBuilder? If not, would you amenable to adding more events so we can implement it as a plugin without resorting to hacky changes?
Thanks in advance!