Use selected dropdown item as repeater title (#4544)

Credit to @DanHarrin. Initial implementation by @MattPurland. Finishes https://github.com/octobercms/october/pull/2956
This commit is contained in:
Dan Harrin 2019-08-16 09:13:35 +01:00 committed by Ben Thomson
parent ecf75e7e46
commit 3365820178

View File

@ -211,9 +211,14 @@
$target = $item
}
var $textInput = $('input[type=text]:first', $target)
var $textInput = $('input[type=text]:first, select:first', $target).first();
if ($textInput.length) {
return $textInput.val()
switch($textInput.prop("tagName")) {
case 'SELECT':
return $textInput.find('option:selected').text();
default:
return $textInput.val();
}
} else {
var $disabledTextInput = $('.text-field:first > .form-control', $target)
if ($disabledTextInput.length) {