Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
i havent come across anyone using Select2 in their extensions. theres a look and feel we wanted to be consistent that we need to create a select2 extension.
i cant appear to be able to integrate it, im just starting out and a simple load isnt invoking select2. here is part of my code:
require.config({packages: [{name: 'select2lib',main: 'select2lib'}],
paths: {'select2lib': 'https://cdnjs.cloudflare.com'}
});
define( [ "qlik", 'jquery',
"./Properties",
"select2lib/ajax/libs/select2/4.0.0/js/select2.min",
'text!./select2.min.css',
'text!./Style.css',
],
function ( qlik, $,
properties,
select2min,
select2mincss,
cssContent) {
this is how i invoke it:
$(containerID).select2({
templateResult: function (data) {
var $res = $('<span></span>');
var $check = $('<input type="checkbox" />');
$res.text(data.text);
if (data.element) {
$res.prepend($check);
$check.prop('checked', data.element.selected);
}
return $res;
}
});
i dont encounter any errors but when i inspect the page, it doesnt look like select2 was even being called.
hoping someone can help
thanks,
edwin
*edited the invoke to select2 (was playing around with it)
Hi @edwin are you loading select2 from internet?
I usually load external js code directly in my project folder in this way
define(["qlik", "./properties", "./plotly-latest.min", "text!./style.css", "./locale/plotly-locale-it"
],
function (qlik, properties, Plotly, cssContent, localeIt) {
And this is my project structure
Please check if you are pointing to the correct folder and try to remove require.config from beginning of your code.
Hi @edwin are you loading select2 from internet?
I usually load external js code directly in my project folder in this way
define(["qlik", "./properties", "./plotly-latest.min", "text!./style.css", "./locale/plotly-locale-it"
],
function (qlik, properties, Plotly, cssContent, localeIt) {
And this is my project structure
Please check if you are pointing to the correct folder and try to remove require.config from beginning of your code.
Hi Alex
thanks for the response. ive already done a couple scenarios. ive done one where i copied the JS file locally - for that situation i didnt use the require.
ill try once more and see
Hi,
i thought i did this already but i guess i havent and it did work.
thanks Alex,
edwin