Closed ljack closed 8 years ago
Can't you just create the schema dinamically when you get the users?
Yes, I might have to reconsider my approach.
2016-04-06 13:47 GMT+03:00 Giulio Canti notifications@github.com:
Can't you just create the schema dinamically when you get the users?
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/gcanti/tcomb-form/issues/311#issuecomment-206305045
Ok, feel free to re-open this issue if you need help.
Ok, changed how the schema is generated
export default function() {
var users = Meteor.users.find().fetch();
var values = {};
users.map((user) => {
values[user._id] = user.profile.name;
});
var Users = t.enums(values, "Users");
var Schema = t.struct({
_id: t.maybe(t.String),
name: t.String, // a required string
owner: t.maybe(t.String),
sharedTo: t.list(Users),
done: t.Boolean
});
return Schema;
}
And it works ;)
Now the next thing I'd like archive is that in the tcomb-form UI when ever I add one of the users I'd like to remove if from the selectable values.. So that if the Todo is shared to everyone there're no more users to add. And also to prevent from adding the same user multiple times.
Any hints?
Hi, I's going through the documents but being new to tcomb and tcomb-form I don't understand how to achieve following: I want to be able to fill in possible values to t.list just before rendreing the
Maybe I'm doing something upside down but just can't figure it out ;)