Skip to content

fromJSON() with validatePropertyValues: true produces an error when choices are defined using a callback that references the object instance #10845

@andrewtelnov

Description

@andrewtelnov

When a Serializer property defines choices via the choicesCallback function (used to fetch choices asynchronously, e.g., from a server for Creator property grid), JSON validation that checks property values throws a JavaScript error.

Add a property with a choices callback, for example:

  Serializer.addProperty("question", { name: "prop1", choices: (obj: Base, choicesCallback: (choices: any) => void) => {
    if (obj.getType() === "text") {
      choicesCallback([1, 2, 3]);
    } else {
      choicesCallback([4, 5, 6]);
    }
  } });

Metadata

Metadata

Assignees

Labels

buguser issueAn issue or bug reported by users

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions