Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regarding Issue #48: I would like to set specific ID's #49

Closed
InannaInai opened this issue Aug 13, 2019 · 4 comments
Closed

regarding Issue #48: I would like to set specific ID's #49

InannaInai opened this issue Aug 13, 2019 · 4 comments

Comments

@InannaInai
Copy link

Dear freegroup

I need to set specific ID's to the rects, how else would i know to data I want for that specific rect.

How can I do that?

@freegroup
Copy link
Owner

why did you open a new issue?!

the rect has already an unique id.

@InannaInai
Copy link
Author

Because you are closing the ones that are in my opinion not solved jet.

the rect has already an unique id.

How can I use this id?
I want to assing a data from a database to the rects.
I want to create a pattern with drag and drop, assign data to every rect and connection in this pattern, save this pattern and reload it again.

is this possible with draw2d?

@freegroup
Copy link
Owner

You can add comments even on closed issues

your code has a syntax error

 init: function (attr, setter, getter) {
    this._super(extend({
      bgColor: this.DEFAULT_COLOR,
      color: this.DEFAULT_COLOR.darker(),
      width: 50,
      height: 50,
      id="thisIsMyID"
    }, attr), setter, getter)
    this.createPort("output")
    this.installEditPolicy(new draw2d.policy.figure.RectangleSelectionFeedbackPolicy())
  },

id="..." is wrong - use :

you can use figure.setUserData(....) as well. please read the API docu for details.
what did you mean with pattern?

@InannaInai
Copy link
Author

I used it with : id:"thisIsMyID", made a mistake when tried to reproduce it.

Thank for the tip with the figure.setUserData(....), must have missed it. Am kinda edgy today...
sry for that
I think my problem is, that I can't see the id with the browser, therefore I had assumed that the rect did not get the id. Tried it with alert and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants