selectize.js add option dynamically with class attribute - selectize.js

I am trying to dynamically add an option to the select dropdown
I use the following code:
selectize.addOption({value:tuples[key].label,text:value});
However now I also want to add a class attribute to the option tag.
I tried the following:
selectize.addOption({value:tuples[key].label,text:value,'class':'subdivide'});
However it does not add the class "subdivide" to the option
Could anybody suggest how can I add the class attribute to the option tag when adding the option.

Related

How can I readonly attribute in Backoffice config.xml dynamic

I want to set/unset readonly attribute of certain field in backoffice editor area based upon the property that is defined in local.properties.
I tried doing following:
<editorArea:attribute qualifier="xyz" readonly="spring.getBean('configurationService').getConfiguration().getBoolean('make.me.readonly')"/>
but there was schema validation error and also it didn't change the field attribute.
First you need to register "configurationService" so that it could be used in config.xml.
By default only the services mentioned in,
platformbackoffice.available.bean.names.for.spel=labelService,enumerationService,exceptionTranslationService,backofficeTypeUtils can be used within config.xml.
To include "configurationService" add the below piece of code to your backoffice-spring.xml.
<cng:list-extender bean="fixedBeanResolver" property="availableBeanNames">
<cng:add value-type="java.lang.String">
<value>configurationService</value>
</cng:add>
</cng:list-extender>
And then make the service call from config.xml,
<editorArea:attribute qualifier="xyz" readonly="#configurationService.getConfiguration().getBoolean('make.me.readonly')"/>

Add simple text/description to a page in Rails Admin

Is there a way to add text to a page in rails admin? I'd like to add a description to a page. I know the label can be edited, but I'd like to be able to add a description to a page underneath the label.
There's no builtin way to do that, but you can do it like this:
You have to override the file where rails admin puts that title but placing a copy of the original file on your own project
app/views/layouts/rails_admin/pjax.html.haml
Then you can access your model like this on that file:
.page-header
%h1= #page_name
%div
= #abstract_model.model.your_awesome_description
And in your model you just need to add a class method
class QualifiedUsers < ApplicationRecord
def self.your_awesome_description
'These users are greeeat'
end
end
If you want a description per object, you have #object available on pjax and you just add the instance method.
I know is not that maintainable to override default partials, but rails_admin give us no option to do this and i figured this is the lest intrusive you can do what you want.

Angular Formly - Is it possible to change the fields className with expressionProperties

I have an Angular Formly form with a checkbox and I want to set a class on the wrapper based on if the field is checked or not.
So in the same way that I can do
expressionProperties: {
'templateOptions.label': '$viewValue'
}
is it possible to do something like
expressionProperties: {
'className': '$viewValue'
}
I don't seem to be able to get it to work.
Here's how you'd do it: https://jsbin.com/nerijo/edit?js,output
Basic idea: Your wrapper can reference the formControl object to get the $viewValue directly. You could also have it reference a data property that you set with expressionProperties. You could also use a templateManipulator to add the template (instead of a wrapper). angular-formly is very flexible.

How to override standard module class in joomla 3

Tell me please how can i override the standart class ModArticlesCategoryHelper, located in /modules/mod_articles_category/ ?
I want customize this class, but i don't want modify a joomla core.
go to the module and click on the Advanced tab. Module Class Suffix - put some class here, make sure you put space before the class name. Like this " mycustomclass"
Then you can style anything withing that ul as you wish, for example:
ul.mycustomclass li a.ModArticlesCategoryHelper {your custom css}

Adding a 'None' or 'All' Option to JavaFx ComboBox

I was wondering how I might go about adding a 'None' or 'All' option to a JavaFx combobox control. My current combobox is backed by a list of complex objects, but just displays the name of he object. I was hoping to avoid have to create a Dummy object with the name "None" or "All".
You can use the promptText property, inherited from class javafx.scene.control.ComboBoxBase.

Resources