Improvements to selectization
This commit is contained in:
parent
54029c2941
commit
7dfff9f9ee
|
@ -1,11 +1,12 @@
|
|||
/**
|
||||
* selectize one select widget. Substitute the actual id of the widget for `{{widget_id}}`.
|
||||
* selectize one select widget. Substitute the actual id of the widget for `{{widget_id}}`,
|
||||
* and the current value for {{widget_value}}.
|
||||
*/
|
||||
$('#{{widget_id}}').selectize({
|
||||
valueField: 'id',
|
||||
labelField: 'name',
|
||||
searchField: 'name',
|
||||
options: [],
|
||||
hideSelected: false,
|
||||
create: false,
|
||||
|
||||
load: function(query, callback) {
|
||||
|
@ -25,4 +26,4 @@ $('#{{widget_id}}').selectize({
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
})[0].selectize.setValue({{widget_value}}, true);
|
||||
|
|
|
@ -266,8 +266,14 @@
|
|||
farkey
|
||||
"}}' {% ifequal record."
|
||||
(-> property :attrs :name)
|
||||
" option." farkey "%}selected{% endifequal %}>"
|
||||
(s/join " " (map #(str "{{option." (:name (:attrs %)) "}}") fs-distinct))
|
||||
" option." farkey "%}selected='selected'{% endifequal %}>"
|
||||
(s/join " " (map
|
||||
#(str
|
||||
"{{option."
|
||||
(:name (:attrs %))
|
||||
(if (= (-> % :attrs :type) "entity") "_expanded")
|
||||
"}}")
|
||||
fs-distinct))
|
||||
"</option>{% endfor %}")]))
|
||||
|
||||
|
||||
|
@ -616,7 +622,8 @@
|
|||
(> magnitude 2)
|
||||
(embed-script-fragment
|
||||
"resources/js/selectize-one.js"
|
||||
[["{{widget_id}}" (-> property :attrs :name)]]
|
||||
[["{{widget_id}}" (-> property :attrs :name)]
|
||||
["{{widget_value}}" (str "{{record." (-> property :attrs :name) "}}")]]
|
||||
))))
|
||||
(children-with-tag entity :property #(= (-> % :attrs :type) "entity")))
|
||||
(if
|
||||
|
|
Loading…
Reference in a new issue