From ce96b2245e5b0a14f075d44407f009feb9ca4e5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jordan=20Aug=C3=A9?= Date: Wed, 9 Jul 2014 13:52:07 +0200 Subject: [PATCH] update --- manifoldapi/static/js/manifold.js | 4 +++- plugins/apply/static/js/apply.js | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/manifoldapi/static/js/manifold.js b/manifoldapi/static/js/manifold.js index e90622c8..e261efeb 100644 --- a/manifoldapi/static/js/manifold.js +++ b/manifoldapi/static/js/manifold.js @@ -1732,7 +1732,9 @@ case TYPE_LIST_OF_VALUES: /* Process update query in parent */ path = this._get_query_path(query_ext); arr = update_query.params[path]; - arr = $.grep(arr, function(x) { return x != data.value; }); + + var key = manifold.metadata.get_key(query.object); + arr = $.grep(arr, function(x) { return (!(manifold._record_equals(x, data.value, key))); }); if (update_query.params[path] === undefined) update_query.params[path] = Array(); update_query.params[path] = arr; diff --git a/plugins/apply/static/js/apply.js b/plugins/apply/static/js/apply.js index a664ce5a..efc93450 100644 --- a/plugins/apply/static/js/apply.js +++ b/plugins/apply/static/js/apply.js @@ -83,13 +83,25 @@ }, - find_row: function(key) + find_row: function(value) { + var KEY_POS, VALUE_POS, data, object_type, object_key; + + TYPE_POS = 1; // key in third position, column id = 2 - var KEY_POS = 2; + VALUE_POS = 2; var cols = $.grep(this.table.fnSettings().aoData, function(col) { - return (col._aData[KEY_POS] == key); + cur_value = col._aData[VALUE_POS]; + object_type = col._aData[TYPE_POS]; + object_key = manifold.metadata.get_key(object_type); + + if (cur_value[0] == '{') { + cur_value = JSON.parse(cur_value); + return manifold._record_equals(cur_value, value, object_key);_ + } else { + return (cur_value == value); + } } ); if (cols.length == 0) -- 2.47.0