mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 16:14:35 +02:00
post an empty array to remove an array from settings
This commit is contained in:
parent
188320a7b7
commit
90c73dc9e1
2 changed files with 11 additions and 2 deletions
|
@ -102,8 +102,15 @@ $(document).ready(function(){
|
||||||
row.empty()
|
row.empty()
|
||||||
row.html("<input type='hidden' class='form-control' name='" + row.attr("name") + "' data-changed='true' value=''>");
|
row.html("<input type='hidden' class='form-control' name='" + row.attr("name") + "' data-changed='true' value=''>");
|
||||||
} else {
|
} else {
|
||||||
// just remove this row completely - the removal of the hidden input will remove it from the array on post
|
if (table.children('tr.row-data').length) {
|
||||||
row.remove()
|
// this isn't the last row - we can just remove it
|
||||||
|
row.remove()
|
||||||
|
} else {
|
||||||
|
// this is the last row, we can't remove it completely since we need to post an empty array
|
||||||
|
row.empty()
|
||||||
|
row.html("<input type='hidden' class='form-control' name='" + table.attr("name").replace('[]', '')
|
||||||
|
+ "' data-changed='true' value=''>");
|
||||||
|
}
|
||||||
|
|
||||||
// we need to fire a change event on one of the remaining inputs so that the sidebar badge is updated
|
// we need to fire a change event on one of the remaining inputs so that the sidebar badge is updated
|
||||||
badgeSidebarForDifferences($(table))
|
badgeSidebarForDifferences($(table))
|
||||||
|
|
|
@ -295,6 +295,8 @@ void DomainServerSettingsManager::updateSetting(const QString& key, const QJsonV
|
||||||
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
void DomainServerSettingsManager::recurseJSONObjectAndOverwriteSettings(const QJsonObject& postedObject,
|
||||||
QVariantMap& settingsVariant,
|
QVariantMap& settingsVariant,
|
||||||
const QJsonArray& descriptionArray) {
|
const QJsonArray& descriptionArray) {
|
||||||
|
|
||||||
|
qDebug() << postedObject;
|
||||||
// Iterate on the setting groups
|
// Iterate on the setting groups
|
||||||
foreach(const QString& groupKey, postedObject.keys()) {
|
foreach(const QString& groupKey, postedObject.keys()) {
|
||||||
QJsonValue groupValue = postedObject[groupKey];
|
QJsonValue groupValue = postedObject[groupKey];
|
||||||
|
|
Loading…
Reference in a new issue