2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

removed bug in treesort

git-svn-id: https://svn.fhem.de/fhem/trunk@3370 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
johannnes 2013-06-30 10:32:27 +00:00
parent 951a4b4d59
commit a526ec16f0
2 changed files with 51 additions and 45 deletions

View File

@ -278,7 +278,7 @@ UPD 2013-04-28_02:00:20 1205 www/frontend/app/view/ChartGridPanel.js
UPD 2013-04-03_07:26:40 15793 www/frontend/app/view/DevicePanel.js
UPD 2013-06-30_11:47:44 11076 www/frontend/app/view/Viewport.js
UPD 2013-06-27_09:35:22 10042 www/frontend/app/view/TableDataGridPanel.js
UPD 2013-06-30_11:46:54 83500 www/frontend/app/controller/ChartController.js
UPD 2013-06-30_12:31:20 83887 www/frontend/app/controller/ChartController.js
UPD 2013-06-30_11:46:54 18379 www/frontend/app/controller/MainController.js
UPD 2013-06-30_11:46:54 5415 www/frontend/app/controller/TableDataController.js
UPD 2013-04-01_07:04:35 202 www/frontend/app/model/ReadingsModel.js

View File

@ -1753,54 +1753,60 @@ Ext.define('FHEM.controller.ChartController', {
* handling the moving of nodes in tree, saving new position of saved charts in db
*/
movenodeintree: function(treeview, action, collidatingrecord) {
var rec = action.records[0],
var unsorted = Ext.ComponentQuery.query('treepanel button[name=unsortedtree]')[0].pressed;
//only save orders when in sorted mode
if (!unsorted) {
var rec = action.records[0],
id = rec.raw.data.ID;
if (rec.raw.data && rec.raw.data.ID && rec.raw.data.TYPE === "savedchart") {
var rootNode = this.getMaintreepanel().getRootNode();
rootNode.cascadeBy(function(node) {
if (node.raw && node.raw.data && node.raw.data.ID && node.raw.data.ID === id) {
//updating whole folder to get indexes right
Ext.each(node.parentNode.childNodes, function(node) {
var ownerfolder = node.parentNode.data.text,
index = node.parentNode.indexOf(node);
if (node.raw.data && node.raw.data.ID && node.raw.data.VALUE) {
var chartid = node.raw.data.ID,
chartconfig = node.raw.data.VALUE;
chartconfig.parentFolder = ownerfolder;
chartconfig.treeIndex = index;
var encodedchartconfig = Ext.encode(chartconfig),
url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+""+""+""+updatechart+""+""+' + chartid + '+' + encodedchartconfig + '&XHR=1';
if (rec.raw.data && rec.raw.data.ID && rec.raw.data.TYPE === "savedchart") {
var rootNode = this.getMaintreepanel().getRootNode();
rootNode.cascadeBy(function(node) {
if (node.raw && node.raw.data && node.raw.data.ID && node.raw.data.ID === id) {
//updating whole folder to get indexes right
Ext.each(node.parentNode.childNodes, function(node) {
var ownerfolder = node.parentNode.data.text,
index = node.parentNode.indexOf(node);
Ext.Ajax.request({
method: 'GET',
disableCaching: false,
url: url,
success: function(response){
var json = Ext.decode(response.responseText);
if (json && json.success === "true" || json.data && json.data.length === 0) {
//be quiet
} else if (json && json.msg) {
Ext.Msg.alert("Error", "The new position could not be saved, error Message is:<br><br>" + json.msg);
} else {
Ext.Msg.alert("Error", "The new position could not be saved!");
if (node.raw.data && node.raw.data.ID && node.raw.data.VALUE) {
var chartid = node.raw.data.ID,
chartconfig = node.raw.data.VALUE;
chartconfig.parentFolder = ownerfolder;
chartconfig.treeIndex = index;
var encodedchartconfig = Ext.encode(chartconfig),
url = '../../../fhem?cmd=get+' + FHEM.dblogname + '+-+webchart+""+""+""+updatechart+""+""+' + chartid + '+' + encodedchartconfig + '&XHR=1';
Ext.Ajax.request({
method: 'GET',
disableCaching: false,
url: url,
success: function(response){
var json = Ext.decode(response.responseText);
if (json && json.success === "true" || json.data && json.data.length === 0) {
//be quiet
} else if (json && json.msg) {
Ext.Msg.alert("Error", "The new position could not be saved, error Message is:<br><br>" + json.msg);
} else {
Ext.Msg.alert("Error", "The new position could not be saved!");
}
},
failure: function() {
if (json && json.msg) {
Ext.Msg.alert("Error", "The new position could not be saved, error Message is:<br><br>" + json.msg);
} else {
Ext.Msg.alert("Error", "The new position could not be saved!");
}
}
},
failure: function() {
if (json && json.msg) {
Ext.Msg.alert("Error", "The new position could not be saved, error Message is:<br><br>" + json.msg);
} else {
Ext.Msg.alert("Error", "The new position could not be saved!");
}
}
});
}
});
}
});
});
}
});
}
});
}
}
}
});