Hybrid View
-
2 Feb 2012 10:28 AM #1
Answered: ValueProvider+RequestFactory - how to access properties of nested object?
Answered: ValueProvider+RequestFactory - how to access properties of nested object?
Hi everybody,
i'm trying to figure out how to display properties from related object in a grid.
Let's say I have entity object called "Song",that is relating to "Genre" object.
Now,what I want to achieve is to display list of "Song" objects on grid,but also include some of the details from related "Genre" object.
From what I read on GXT 3.0, valueProviders should be able to do that, but I haven't found out how to do it.
So far,I have managed to do this without problem:
interface SongProxyProperties extends PropertyAccess<SongProxy> {
ModelKeyProvider<SongProxy> id();
ValueProvider<SongProxy, String> artist();
.
.
.
ValueProvider<GenreProxy, String> genre(); ?????????
}
Can anyone help me with this?
Tnx,
Igor
-
Best Answer Posted by IgyBoy
Never mind, figured it out - have read about GWT Editor framework a bit...
-
4 Feb 2012 1:31 AM #2
Never mind, figured it out - have read about GWT Editor framework a bit...
Last edited by IgyBoy; 4 Feb 2012 at 5:31 AM. Reason: Figured it out.
-
22 Feb 2012 4:10 AM #3
How did you do it finally?
How did you do it finally?
Hey Igor,
Could you tell us how you did it? We are also looking for the same thing, but reading GWT Editor docs did not make us any wiser
...
Thanks,
Koen
-
22 Feb 2012 4:48 AM #4
Hi koenjan,
the "@Path" annotation is what you are looking for:
From the GWT docs:
"The @Path annotation may be used on the field or accessor method to specify a dotted property path or to bypass the implicit naming convention. For example:
class PersonEditor implements Editor<Person> {
// Corresponds to person.getManager().getName()
@Path("manager.name");
Label managerName;
}
So, in the example that I had above:
interface SongProxyProperties extends PropertyAccess<SongProxy> {
ModelKeyProvider<SongProxy> id();
ValueProvider<SongProxy, String> artist();
@Path("genre.genreName")
ValueProvider<SongProxy, String> songGenre();
}
The @Path("genre.genreName") is basically saying: take "genreName" property from related "genre" object, and expose it as "songGenre" in SongProxyProperties interface.
Hope this was helpfull.
Cheers,
Igor
-
22 Feb 2012 6:28 AM #5
Thank you for your response...
In fact, we already tried the @Path annotation, but somehow we got NullPointerExceptions...
after some debugging, we found that to be able to use
that instead ofCode:@Path("type.name") ValueProvider<DetailProxy, String> typeName;
which did not include the <DetailTypeProxy> inside the <DetailProxy>,Code:detailRequest.get().find(requestId).fire(receiver<DetailProxy>)
we had to do
maybe this is useful for others...Code:detailRequest.get().find(requestId).with("type").fire(receiver<DetailProxy>)
-
19 Oct 2012 10:51 AM #6
I am having a very similar issue. I am using RequestFactory with Hibernate to populate a Sencha grid with a paging toolbar. By using the path annotation I was able to successfully populate the grid with data. I then tried to implement the paging toolbar which requires the use of RequestFactoryProxy and am now receiving a NullPointerException for the Columns in the grid that access nested objects. It seems that the use of the with() method within the context of RequestFactoryProxy doesn't work as expected.


Reply With Quote