Pregunta

Hello I need to show with jtable an entity. i have in my db impl/dto one 'one to many relationship', this boils down to have a set of objects related with an entity. More specifically:

public class UserEntityDTOImpl{
  @JsonProperty("UserId")
  private Long userId;
  @JsonProperty("UserName")
  private String userName;
  ....
  @JsonProperty("UserAddress")
  private Set<AddressEntityDTOImpl> userAddress = new HashSet<AddressEntityDTOImpl>(0);
  ...
}

public class AddressEntityDTOImpl  {
      @JsonProperty("AddressId")
        private Long address_id;
      @JsonProperty("Country")
        private String country;
      @JsonProperty("Address")
        private String detailAddress;
      @JsonProperty("PostCode")
        private String postCode;
....
}

and i am talking about UserAddress.

What i want is to use jtable and have enabled CRUD operations on the user including address list of each user (see user's address list, delete address list entries, add new address list entries and update existing ones).

I am stuck exaclty on the address list and need help on jtable as i am tottaly new to jtable/jquery/javascript.

i was thinking jtable supports something like this but could not find anything. The way i was thinking of it was to have something like one jtable inside another in terms that each user in my main jtable has one inner jtable which would have the address list.

Is this possible? If yes a short example how i can do this would be perfect. If no, anyone had same issue to cope with and any proposals how to handle it? If nothing of the above is applicable, one further question is as follows to use as work around, can i add somehow an extra button per row (next to delete/update buttons of jtable), which when pressed will direct me to another page? i.e. {edit address button}-->/users/edit/address?userId={user.getId} then if this is possible i could have a second jquery at another page to cope with specific user's address list.

¿Fue útil?

Solución

Does this look similar to your use case?

http://jtable.org/Demo/MasterChild

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top