PDA

View Full Version : Bind Joose Object to ExtJs form



jeusdi
26 Nov 2010, 4:46 AM
It would be possible to load an Joose object to a Extjs form and vice versa?

User Class:


JooseClass("User", {
has: {
id: {
is: "rw",
init: null
},
login: {
is: "rw",
init: null
},
name: {
is: "rw",
init: null
},
role: {
is: "rw",
init: null
}
},
before: {
initialize: function() {
this.id = -1;
this.login = "";
this.name = "";
this.role = Roles.UNKNOWN;
}
}
});


ExtJs form:


new Ext.FormPanel({
...
items:[{
fieldLabel: "Login",
name: "login",
emptyText: "Introdu´r nom d'usuari",
blankText: "╔s necessari introduir un nom d'usuari",
...
},
{
fieldLabel: "Name",
name: "name",
...
},
...
],
...


I would like me do it:


var user = new User();
user.setLogin("login");
user.setName("name");
form.load(user);
...