Working in the update nodes action.
This commit is contained in:
parent
2e30bb183f
commit
0142f609df
|
@ -257,7 +257,11 @@ MapController.prototype.get_node = function(id_graph) {
|
||||||
|
|
||||||
$.each(nodes, function(i, node) {
|
$.each(nodes, function(i, node) {
|
||||||
if (node['graph_id'] == id_graph) {
|
if (node['graph_id'] == id_graph) {
|
||||||
|
|
||||||
|
node['index_node'] = i;
|
||||||
|
|
||||||
return_node = node;
|
return_node = node;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -2113,19 +2113,28 @@ NetworkmapController.prototype.editNode = function(target) {
|
||||||
* This function aplies the new data to the node
|
* This function aplies the new data to the node
|
||||||
*/
|
*/
|
||||||
NetworkmapController.prototype.apply_edit_node = function(data_graph_id) {
|
NetworkmapController.prototype.apply_edit_node = function(data_graph_id) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
var node_id = data_graph_id;
|
var node_id = data_graph_id;
|
||||||
|
|
||||||
var new_label = $("#edit_node_dialog_" + node_id + " input[id='text-label']").val();
|
var new_label = $("#edit_node_dialog_" + node_id + " input[id='text-label']").val();
|
||||||
var new_shape = $("#edit_node_dialog_" + node_id + " select[id='shape']").val();
|
var new_shape = $("#edit_node_dialog_" + node_id + " select[id='shape']").val();
|
||||||
|
|
||||||
$('#' + node_id + " text").text(new_label);
|
var id_graph = node_id.replace(/node_/, "");
|
||||||
|
|
||||||
switch (new_shape) {
|
var node = self.get_node(id_graph);
|
||||||
case 'circle':
|
|
||||||
break;
|
node['title'] = new_label;
|
||||||
case 'rhombus':
|
node['shape'] = new_shape;
|
||||||
break;
|
|
||||||
case 'square':
|
nodes[node['index_node']] = node;
|
||||||
break;
|
|
||||||
}
|
d3.selectAll(self._target + " #" + node_id + " *")
|
||||||
|
.remove();
|
||||||
|
|
||||||
|
self.paint_node(d3.select(self._target + " #" + node_id).node(), node);
|
||||||
|
|
||||||
|
self.move_arrow(id_graph);
|
||||||
|
|
||||||
|
$("#edit_node_dialog_" + node_id).dialog("close");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue