Hey there,
I'm having a issue with the Select2 plugin where the plugin requires a blank value as the first option so that the field doesn't default to the first option in the list (a legitimate value). I need to inject my own options.
fields: [
{
"label": "User Group Visibility:",
"name": "TaskType.UserGroupVisiblity",
"type": "select",
"multiple": true,
"separator": ',',
"options": [
{ label: "No Group Association", value: "Any" },
{ label: "Tech", value: "Tech" },
{ label: "Truckload", value: "Truckload" },
{ label: "Pricing", value: "Pricing" }
]
}
Like the example above basically, but I need the options that come over with this as well to combine into the predefined options. (see below for my server side code)
Field::inst( 'TaskType.UserIDAssociatedTo' )
->options( 'Users', 'id', array('EmailAddress', 'FirstName', 'LastName'), null, function ( $row ) {
return $row['FirstName'].' '.$row['LastName'].' ('.$row['EmailAddress'].')';
} )
Secondary but partially related issue, I have my table set to refresh the data at specified intervals using the code below
setInterval( function () {
table.ajax.reload( null, false ); // user paging is not reset on reload
}, interval );
But it seems that when i do this it is resetting the value of the select2 plugin to the value it was initialized with instead of what is in the record I have open to edit.
I'm happy to provide access to the page if someone can take a look.