SuperComboSelect Filtering
using a many-to-many relationship in a model and am noticing some quirkiness with the filter option of the supercomboselect -- right now it just highlights the term you search for rather than highlights and sometimes it doesn't even do that. It may be that my list is too large (there's over 700 items in it)? Is there a way to override the functionality of the supercomboselect so it does a filter hide/show?
Comments
1. Download the files from http://ivaynberg.github.io/select2/.
2. Place the select2.js file at assets/js/select2/select2.js
3. Place the select2.css file at assets/css/select2/select2.css
4. Create a new class file at fuel/application/libraries/MY_custom_fields.php and add the following:
class MY_custom_fields { function tags($params) { $form_builder =& $params['instance']; $js = '<script type="text/javascript"> $(function(){ $(".field_type_tag").select2(); }) </script>'; $form_builder->add_js($js); $params['class'] = (!empty($params['class'])) ? $params['class'].' field_type_tag' : 'field_type_tag'; $params['type'] = 'select'; $params['multiple'] = TRUE; return $form_builder->create_select($params); } }
5. Then add the following to the fuel/application/config/custom_fields.php file:
$fields['tags'] = array( 'class' => 'MY_custom_fields', 'function' => 'tags', 'css' => 'select2/select2', 'js' => array( 'select2/select2', ), 'represents' => array('name' => 'tags'), );
5. Lastly, in your form fields, use a field type of "tags":
$fields['my_field']['type'] = 'tags';
More can be found here about creating custom field types:
http://docs.getfuelcms.com/general/forms#association_parameters