Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add all possible bootstrap-multiselect options #31

Merged
merged 1 commit into from
Mar 11, 2016
Merged

Add all possible bootstrap-multiselect options #31

merged 1 commit into from
Mar 11, 2016

Conversation

lvgunst
Copy link
Contributor

@lvgunst lvgunst commented Mar 11, 2016

I needed the buttonTitle configuration option and saw it was missing in get-options.js. I've refreshed (and sorted) the list of possible bootstrap-multiselect options by running the following:

Object.keys($.fn.multiselect.prototype.constructor.Constructor.prototype.defaults).sort()

I've removed multiple because it is not configuration options. It will automatically be set when the attribute multiple is set on the <select> element.
https://github.com/davidstutz/bootstrap-multiselect/blob/master/dist/js/bootstrap-multiselect.js#L193

Maybe you can automatically detect new options by using $.fn.multiselect.prototype.constructor.Constructor.prototype.defaults instead of get-options.js. I'm not sure if there is a nicer way to get the defaults.

@skratchdot
Copy link
Owner

Oh, nice! Thanks for this. I've been using gulp get-options, so it would be nice to update that function with this code:

gulp.task('get-options', function () {
request('http://davidstutz.github.io/bootstrap-multiselect/', function (error, response, body) {
var $ = cheerio.load(body);
var options = $('table').first().find('td').filter(function (i) {
return i % 2 === 0;
}).map(function () {
return $(this).text().trim();
}).get();
if (options.indexOf('templates') === -1) {
options.push('templates');
}
options = options.sort();
fs.writeFile('./lib/get-options.js', [
'/* generated by gulpfile.js */',
'module.exports = exports = function () {',
'\treturn ' + JSON.stringify(options, null, '\t\t') + ';',
'}'
].join('\n'), 'utf-8');
});
});

skratchdot added a commit that referenced this pull request Mar 11, 2016
Add all possible bootstrap-multiselect options
@skratchdot skratchdot merged commit 6b82648 into skratchdot:master Mar 11, 2016
@lvgunst lvgunst mentioned this pull request Mar 14, 2016
@lvgunst
Copy link
Contributor Author

lvgunst commented Mar 14, 2016

Could you please publish a new release? Thank you.

@lvgunst lvgunst deleted the fix-all-options branch March 14, 2016 14:14
@skratchdot
Copy link
Owner

Ok. Just published 1.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants