anderly / piklist-field-addons

Piklist Field Addons
8 stars 1 forks source link

piklist-field-addons.js #1

Open macedd opened 10 years ago

macedd commented 10 years ago

Whats the use of this script? There are no comment

Yet not sure why the need of the "wrapper" js for the custom fields... What I'm missing?

Cheers

anderly commented 10 years ago

piklist-field-addons.js is used as an initialization script for all custom piklist field add-ons following the convention in this project. For example, I added a "select2" type field and the select2 library requires that you initialize the select box on page load with a call to .select2() (see here: http://ivaynberg.github.io/select2/). So, this script is used for any js initialization that must be done for custom piklist field addons. It loops through all defined piklist fields and runs custom init code based on the field "type." For instance, you could add a custom piklist field type using the popular "chosen" library (http://harvesthq.github.io/chosen/) and you would need to initialize the field on page load by calling .chosen().

Does that answer your question?