From 4e788242bdb85682ba13dcb0caf2d72348479cf4 Mon Sep 17 00:00:00 2001 From: Daniel Schmitzer Date: Wed, 16 Nov 2016 10:47:54 +0000 Subject: - Export Profil (FTP Speicherung / Cron ausführung / XML Erstellung) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5911 0d5edaf7-2b12-4e95-93f4-047927463d4b --- views/js/editable.js | 63 ++++++++++------------------------------------------ 1 file changed, 12 insertions(+), 51 deletions(-) (limited to 'views/js/editable.js') diff --git a/views/js/editable.js b/views/js/editable.js index 353c576..e4eb68f 100644 --- a/views/js/editable.js +++ b/views/js/editable.js @@ -25,50 +25,30 @@ if (typeof options.type == "string") opt['type'] = options.type; - if (options.type == "select" && typeof options.data == "string") - { - - var ar = []; - var arData = jQuery.parseJSON(options.data); - var strValue = jQuery(this).html(); - var value = 0; - - for (var i in arData) - { - - ar.push( { 'value': i, 'text': arData[i] } ); - if (arData[i] == strValue) value = i; - - } - - // Normale Übergabe eines JSON Strings - opt.source = ar; - opt.type = 'select'; - opt.value = value; - - } - else if (options.type == "select" && typeof options.data == "object") + if (options.type == "select" && Array.isArray(options.data)) { - - var value = 0; + + var value = "0"; var strValue = jQuery(this).html(); for (var i in options.data) { - - if (options.data[i] == strValue) value = i; + + if (options.data[i].text == strValue) value = options.data[i].value; } opt.source = options.data; - opt.value = value + opt.type = 'select'; + opt.value = value; - } + } else if (options.type == 'multiarray') { var ar = []; var arData = jQuery.parseJSON(options.data); + var strValue = jQuery(this).html(); for (var i in arData) { @@ -80,6 +60,8 @@ objData['children'].push( { 'value': j, 'text': arData[i]['fields'][j] } ); + if (arData[i]['fields'][j] == strValue) value = j; + } ar.push(objData); @@ -88,29 +70,8 @@ opt.source = ar; opt.type = 'select'; + opt.value = j; - } - else if (options.type == 'string' && typeof options.data == "string") - { - - var ar = []; - var arData = jQuery.parseJSON(options.data); - - for (var i in arData) - { - - ar.push( { - 'value': i, - 'text': arData[i] - } ); - - if (arData[i] == jQuery(this).text()) opt.value = i; - - } - - opt.type = 'select'; - opt.source = ar; - } else { -- cgit v1.2.3