fix slight wrinkle in new Wemo node

This commit is contained in:
Dave Conway-Jones
2016-04-09 18:06:29 +01:00
parent 48bcd3c7df
commit c54a019899
2 changed files with 349 additions and 352 deletions

View File

@@ -164,30 +164,30 @@
return this.name;
},
oneditprepare: function() {
var devices;
$.getJSON('wemoNG/devices', function(data){
devices = data;
var devs = Object.keys(data);
if (devs.length !== 0) {
for (var d in devs) {
if (dev.hasOwnProperty(d)) {
$('<option/>',{
'value': devs[d],
'text': data[devs[d]].name
}).appendTo('#node-config-input-device');
console.log(data[devs[d]].name);
var devices;
$.getJSON('wemoNG/devices', function(data) {
devices = data;
var devs = Object.keys(data);
if (devs.length !== 0) {
for (var d in devs) {
if (devs.hasOwnProperty(d)) {
$('<option/>',{
'value': devs[d],
'text': data[devs[d]].name
}).appendTo('#node-config-input-device');
console.log(data[devs[d]].name);
}
}
}
}
}
});
});
$('#node-config-input-device').change(function(){
var id = $( "#node-config-input-device option:selected" ).first().val();
if (devices) {
$('#node-config-input-type').val(devices[id].type);
$('#node-config-input-name').val(devices[id].name);
}
});
$('#node-config-input-device').change(function() {
var id = $( "#node-config-input-device option:selected" ).first().val();
if (devices) {
$('#node-config-input-type').val(devices[id].type);
$('#node-config-input-name').val(devices[id].name);
}
});
}
});
</script>
</script>