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

Multiple dependency input function #140

Open
appuku10 opened this issue Feb 6, 2020 · 1 comment
Open

Multiple dependency input function #140

appuku10 opened this issue Feb 6, 2020 · 1 comment

Comments

@appuku10
Copy link

appuku10 commented Feb 6, 2020

Hey ,

Code:

`function (names, data, cb) {
var schemas = new Object();
var schema = new Object();

schema.type = "string";

if (data.option1 === "efg") {

    schema.title = "efg";
    schema.enum = ["", ""]
    
} else if (data.option1 === "abc") {
    schema.title = "abc";
    schema.enum = ["", ""]
}

schemas["$.suboption1"] = schema;
setTimeout(function(){cb(schemas)},500); // in order to show asynchrony

}`

How can i get dynamic value instead of "option1" , what parameter should i pass to get Parent Option's Id

@peeyush12345
Copy link

function processOptions(parentId, names, data, cb) {
var schemas = {};
var schema = { type: "string" };

if (data[parentId] === "efg") {
schema.title = "efg";
schema.enum = ["", ""];
} else if (data[parentId] === "abc") {
schema.title = "abc";
schema.enum = ["", ""];
}

schemas["$.sub" + parentId] = schema;
setTimeout(function() {
cb(schemas);
}, 500); // in order to show asynchrony
}

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