Closed surajMetkar33 closed 6 years ago
Please reformat your message with triple back-quotes and language code https://guides.github.com/features/mastering-markdown/#examples > Code
I do not see anywhere in your code the JS and CSS for Selectize !!
@mistic100 I am new to this and do not know exactly which css and js to add in angular cli.json Could u please give any refer link or snippet it tried downloading the selectize.js from standalone folder and included its reference in cli.json but no luck! thanks for immediate reply :)
ERROR TypeError: d[e.plugin] is not a function
at g.createRuleInput (scripts.bundle.js:19)
at g.updateRuleFilter (scripts.bundle.js:19)
at b.update (scripts.bundle.js:19)
at b.dispatch (scripts.bundle.js:4)
at b.q.handle (scripts.bundle.js:4)
at Object.trigger (scripts.bundle.js:5)
at r.fn.init.triggerHandler (scripts.bundle.js:5)
at b.trigger (scripts.bundle.js:20)
at k.set [as filter] (scripts.bundle.js:20)
at HTMLSelectElement.
The files of selectize https://github.com/selectize/selectize.js It's a library it doesn't come from nowhere.
I don't use Angular with explicit configuration I cannot help you.
Hi @mistic100 I overcame that problem by adding below js from the mentioned URLs
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/jQuery-QueryBuilder/dist/js/query-builder.standalone.min.js",
"../src/selectize.js",
"../src/selectize.min.js"
],
and styles
"styles": [
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/bootstrap/dist/css/bootstrap.css",
"../node_modules/jQuery-QueryBuilder/dist/css/query-builder.default.css",
"../node_modules/jQuery-QueryBuilder/doc/css/bootstrap.min.css",
"../src/selectize.bootstrap3.css",
"styles.css"
],
@mistic100 I have a different problem now i have implemented selectize with ajax and was successful with creating the rule JSON but with that rule i am not able to reconcstruct the selectize selected values
any help would be appreciated
code below :
protected rules_basic = {
condition: 'AND',
rules: [{
"id": "ProduitIngredients",
"field": "ProduitIngredients",
"type": "string",
"input": "text",
"operator": "equal",
"value": "Arcu Institute"
}]
};
and
$('#builder').queryBuilder({
plugins: ['bt-tooltip-errors'],
filters: [
{
id: 'ProduitIngredients',
label: 'Ingredients',
type: 'string',
plugin: 'selectize',
plugin_config: {
valueField: 'name',
labelField: 'name',
searchField: 'name',
sortField: 'name',
create: false,
options: [],
render: {
option: function(item, escape) {
return '<div>'+item.name+'</div>';
}
},
load: function(query, callback) {
var that = this;
if (!query.length) return callback();
$.ajax({
url: 'http://querybuilder.js.org/assets/demo-data.json?query=' + encodeURIComponent(query),
type: 'GET',
error: function() {
callback();
},
success: function(res) {
callback(res.slice(0, 10));
}
});
}
},
valueSetter: function(rule, value) {
//rule.$el.find('.rule-value-container input')[0].selectize.setValue(value);
if (rule.operator.nb_inputs > 0) {
debugger;
var val = value.split(',');
var select = rule.$el.find('.rule-value-container').selectize()[0].selectize;
val.forEach(function (item) {
select.addItem(item);
});
select.setValue(val);
}
}
}],
rules: this.rules_basic
});
}
I have refered some code from this issue https://github.com/mistic100/jQuery-QueryBuilder/issues/189 but was still not able to reconstruct the rule
I am working on including jquery query builder in angular 2 cliproject. till now i have am done with everything that is basic for the query builder. currently working on selectize plugin. but when i used the code from : http://querybuilder.js.org/demo.html for seletize i am getting below error. not able to understand the root cause of this and how to overcome it.
angluar CLi.json
formuladetails.ts:
Please help me with this, i am stuck further want to implement selectize with ajax loading