-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
-
Hi all,
I am using selectize for a report and I save off the input entries to local storage so that when users return to the page their query criteria is still populated. However, I am not sure how to load the selection from onInitialize.
<script type="text/javascript"> !function (l) { "use strict"; function e() { } e.prototype.initSelectize = function () { l("#selectize-skus").selectize({ plugins: ["remove_button"], persist: !1, createOnBlur: !0, create: !0, onChange: function (value) { Lockr.set('skus', value); }, onInitialize: function () { var skus = Lockr.get('skus'); if (skus) { this.setValue(skus); } } }); }, e.prototype.init = function () { this.initSelectize() }, l.BillListSelectize = new e, l.BillListSelectize.Constructor = e }(window.jQuery), function () { "use strict"; window.jQuery.BillListSelectize.init(); }(); </script>
You can see that when onChange fires, I save the selections to storage. Then onInitialize should pull those values back from storage and assign, if they exist. However, this doesn't seem to be working and I'm not sure why. I've seen others reference setValue but typically out of the context of the initializer.
FYI: My page actually has multiple selectize inputs but I've stripped those out for clarity.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment