mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
FHEMWEB: mutliple-strict widget, Forum #27105
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@6563 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
89f0c4fa5c
commit
306017975c
@ -3064,7 +3064,12 @@ FW_widgetOverride($$)
|
||||
":slider,<min>,<step>,<max>", then a javascript
|
||||
driven slider is displayed</li>
|
||||
<li>if the modifier is of the form ":multiple,val1,val2,...", then
|
||||
multiple values can be selected, the result is comma separated.</li>
|
||||
multiple values can be selected and own values can be written, the
|
||||
result is comma separated.</li>
|
||||
<li>if the modifier is of the form ":multiple-strict,val1,val2,...", then
|
||||
multiple values can be selected and no new values can be added, the
|
||||
result is comma separated.</li>
|
||||
|
||||
<li>else a dropdown with all the modifier values is displayed</li>
|
||||
</ul>
|
||||
If this attribute is specified for a FHEMWEB instance, then it is
|
||||
@ -3607,9 +3612,13 @@ FW_widgetOverride($$)
|
||||
":slider,<min>,<step>,<max>", so wird ein in
|
||||
JavaScript programmierter Slider angezeigt</li>
|
||||
|
||||
<li>Ist der Modifier ":multiple,val1,val2,...", dann ein
|
||||
Mehrfachauswahl ist möglich, das Ergebnis ist
|
||||
Komma-separiert.</li>
|
||||
<li>Ist der Modifier ":multiple,val1,val2,...", dann ist eine
|
||||
Mehrfachauswahl möglich und es können neue Werte gesetzt
|
||||
werden. Das Ergebnis ist Komma-separiert.</li>
|
||||
|
||||
<li>Ist der Modifier ":multiple-strict,val1,val2,...", dann ist eine
|
||||
Mehrfachauswahl möglich, es können jedoch keine neuen
|
||||
Werte definiert werden. Das Ergebnis ist Komma-separiert.</li>
|
||||
|
||||
<li>In allen anderen Fällen erscheint ein Dropdown mit allen
|
||||
Modifier Werten.</li>
|
||||
|
@ -1,7 +1,7 @@
|
||||
function
|
||||
FW_multipleSelChange(name, devName, vArr)
|
||||
{
|
||||
if(vArr.length < 2 || vArr[0] != "multiple")
|
||||
if(vArr.length < 2 || (vArr[0] != "multiple" && vArr[0] != "multiple-strict"))
|
||||
return undefined;
|
||||
|
||||
var o = new Object();
|
||||
@ -10,14 +10,17 @@ FW_multipleSelChange(name, devName, vArr)
|
||||
o.newEl.size=30;
|
||||
o.qFn = 'FW_multipleSetSelected(qArg, "%")';
|
||||
o.qArg = o.newEl;
|
||||
o.newEl.setAttribute('onFocus', 'FW_multipleSelect(this)');
|
||||
|
||||
o.newEl.setAttribute('onFocus', vArr[0] == "multiple-strict" ?
|
||||
'FW_multipleSelect(this, true)' : 'FW_multipleSelect(this, false)');
|
||||
|
||||
o.newEl.setAttribute('allVals', vArr);
|
||||
o.newEl.setAttribute('readonly', 'readonly');
|
||||
return o;
|
||||
}
|
||||
|
||||
function
|
||||
FW_multipleSelect(el)
|
||||
FW_multipleSelect(el, strict)
|
||||
{
|
||||
loadLink("pgm2/jquery-ui.min.css");
|
||||
loadScript("pgm2/jquery.min.js", function(){
|
||||
@ -42,10 +45,11 @@ FW_multipleSelect(el)
|
||||
var selArr=[];
|
||||
for(var i1 in selObj)
|
||||
selArr.push(i1);
|
||||
|
||||
$('body').append(
|
||||
'<div id="multidlg" style="display:none">'+
|
||||
'<table>'+table+'</table><input id="md_freeText" '+
|
||||
'value="'+selArr.join(',')+'"/>'+
|
||||
'<table>'+table+'</table>'+(!strict ? '<input id="md_freeText" '+
|
||||
'value="'+selArr.join(',')+'"/>' : '')+
|
||||
'</div>');
|
||||
|
||||
$('#multidlg').dialog(
|
||||
@ -80,3 +84,7 @@ FW_multipleSetSelected(el, val)
|
||||
FW_widgets['multiple'] = {
|
||||
selChange:FW_multipleSelChange
|
||||
};
|
||||
|
||||
FW_widgets['multiple-strict'] = {
|
||||
selChange:FW_multipleSelChange
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user