I need to change the ids of some cells and then retrieve the cells and perform some operations on them. I am changing a cell id and later on retrieving it throught the model. The model doesn't find the cell using the new id but if I try to retrieve the cell from the model using the old id, it finds it. Do I need to update the model each time a cell id is changed and if so, how is this achieved? (I am using the js version) Thank you for your time!

asked 24 Jul '12, 10:22

gfl's gravatar image

gfl
1727
accept rate: 0%

edited 11 Feb '13, 09:55

David's gravatar image

David
4.9k21831


The lookup is in model.cells, you can update that when you change the ID of a cell.

link

answered 24 Jul '12, 11:55

Gaudenz's gravatar image

Gaudenz
80.1k1310
accept rate: 39%

So "cells" is an array in itself and the usage is actually:


model.cells[id] = cell;


(25 Jul '12, 03:40) gfl

If you change the id of a cell, it does not affect the keys of the map of model.cells <cellid (key), mxcell object (value)> in the model of graph. it affects only the value. Am i wrong?

Cause if after cell.setId(newId) we try to get the model.getCell(newId), null will be returned. So someone should do something like:

cell.setId(newId);
Map<String, Object> cells = model.getCells();
cells.remove(oldId);
cells.put(newId, cell);
link

answered 12 Jan '13, 12:37

koula's gravatar image

koula
26210
accept rate: 0%

edited 12 Jan '13, 13:18

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×228
×66
×39
×5

Asked: 24 Jul '12, 10:22

Seen: 3,509 times

Last updated: 05 Jul '14, 03:15