PDA

View Full Version : How to use BaseModel and BaseModelData



brendand
19 Apr 2009, 6:41 PM
Can someone please explain how to use BaseModel and BaseModelData? How do they relate to my actual object on server. Are the required to use GXT's MVC.

I'm creating an application running on Google App Engine.

I have a persistent class called User. Should it extend BaseModel, or do I create another class called UserModel?

I've tried looking at the examples in gxt-2.0-m1\samples\resources\src\com\extjs\gxt\samples\resources\client\model, but haven't been able to figure this out.

gslender
19 Apr 2009, 7:57 PM
Your class should look like this...


public class User extends BaseModel implements Serializable {
private static final long serialVersionUID = 1L;

public User(String name) {
set("user_name", name);
}

public String getName() {
return (String)get("user_name");
}

public void setName(String name) {
set("user_name",name);
}
}


If you do this, you will need to either use this class (along with the GXT dependancies) in your server, or use something like a DTO to move the data into and outof this class - a 3rd option is to use BeanModel and have GXT take care of creating BaseModel classes for you.

brendand
19 Apr 2009, 8:25 PM
Thanks.

I've just bought your book on EXT GWT. Looks like it's going to answer hundreds of my questions.

Do you happen to have full page size version of the image below? I'd like to have that as the cover page of my printed version.

http://www.apress.com/resource/bookcover/9781430219408

gslender
19 Apr 2009, 11:36 PM
The book is now finalised and will be updated online (which will then include the final cover and all chapters with final corrections etc) - I'm guessing this should happen very soon (within the coming week) so best just wait a few more days.

I'm not able to release any content (including the cover) myself.

Cheers,
Grant

mama
16 Jan 2012, 10:49 PM
is it necessary to extend these clasess?

mama
19 Jan 2012, 5:50 AM
guys..plz reply8-|

kremsoft
22 Jan 2012, 5:27 AM
Did you ever get what you wanted?

I'm using ModelData to display a collapsible menu. It works great but I would like to mark some items with a different icon.

I actually bought Developing with Ext GWT but it doesn't contain much about ModelData