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
|
":slider,<min>,<step>,<max>", then a javascript
|
||||||
driven slider is displayed</li>
|
driven slider is displayed</li>
|
||||||
<li>if the modifier is of the form ":multiple,val1,val2,...", then
|
<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>
|
<li>else a dropdown with all the modifier values is displayed</li>
|
||||||
</ul>
|
</ul>
|
||||||
If this attribute is specified for a FHEMWEB instance, then it is
|
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
|
":slider,<min>,<step>,<max>", so wird ein in
|
||||||
JavaScript programmierter Slider angezeigt</li>
|
JavaScript programmierter Slider angezeigt</li>
|
||||||
|
|
||||||
<li>Ist der Modifier ":multiple,val1,val2,...", dann ein
|
<li>Ist der Modifier ":multiple,val1,val2,...", dann ist eine
|
||||||
Mehrfachauswahl ist möglich, das Ergebnis ist
|
Mehrfachauswahl möglich und es können neue Werte gesetzt
|
||||||
Komma-separiert.</li>
|
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
|
<li>In allen anderen Fällen erscheint ein Dropdown mit allen
|
||||||
Modifier Werten.</li>
|
Modifier Werten.</li>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
function
|
function
|
||||||
FW_multipleSelChange(name, devName, vArr)
|
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;
|
return undefined;
|
||||||
|
|
||||||
var o = new Object();
|
var o = new Object();
|
||||||
@ -10,14 +10,17 @@ FW_multipleSelChange(name, devName, vArr)
|
|||||||
o.newEl.size=30;
|
o.newEl.size=30;
|
||||||
o.qFn = 'FW_multipleSetSelected(qArg, "%")';
|
o.qFn = 'FW_multipleSetSelected(qArg, "%")';
|
||||||
o.qArg = o.newEl;
|
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('allVals', vArr);
|
||||||
o.newEl.setAttribute('readonly', 'readonly');
|
o.newEl.setAttribute('readonly', 'readonly');
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
function
|
function
|
||||||
FW_multipleSelect(el)
|
FW_multipleSelect(el, strict)
|
||||||
{
|
{
|
||||||
loadLink("pgm2/jquery-ui.min.css");
|
loadLink("pgm2/jquery-ui.min.css");
|
||||||
loadScript("pgm2/jquery.min.js", function(){
|
loadScript("pgm2/jquery.min.js", function(){
|
||||||
@ -42,10 +45,11 @@ FW_multipleSelect(el)
|
|||||||
var selArr=[];
|
var selArr=[];
|
||||||
for(var i1 in selObj)
|
for(var i1 in selObj)
|
||||||
selArr.push(i1);
|
selArr.push(i1);
|
||||||
|
|
||||||
$('body').append(
|
$('body').append(
|
||||||
'<div id="multidlg" style="display:none">'+
|
'<div id="multidlg" style="display:none">'+
|
||||||
'<table>'+table+'</table><input id="md_freeText" '+
|
'<table>'+table+'</table>'+(!strict ? '<input id="md_freeText" '+
|
||||||
'value="'+selArr.join(',')+'"/>'+
|
'value="'+selArr.join(',')+'"/>' : '')+
|
||||||
'</div>');
|
'</div>');
|
||||||
|
|
||||||
$('#multidlg').dialog(
|
$('#multidlg').dialog(
|
||||||
@ -80,3 +84,7 @@ FW_multipleSetSelected(el, val)
|
|||||||
FW_widgets['multiple'] = {
|
FW_widgets['multiple'] = {
|
||||||
selChange:FW_multipleSelChange
|
selChange:FW_multipleSelChange
|
||||||
};
|
};
|
||||||
|
|
||||||
|
FW_widgets['multiple-strict'] = {
|
||||||
|
selChange:FW_multipleSelChange
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user