简体   繁体   中英

How to Implement gvNIX/Spring Roo Datatables Master-Detail?

I have a simple use case where I have an Invoice table and an Items table.

An Invoice can have many Items and an Item can be on many Invoices, therefore in my database I have an InvoiceItem table too (3 tables total, Invoice, Item and InvoiceItem).

I am using Spring Roo (version 1.3.2 with gvNIX addon (version 1.5). I am wondering if it is possible in the course of creating an Invoice, I can add InvoiceItems on the same page rather than then navigating to the create InvoiceItem page and filling that out separately?

Any advice appreciated.

Tumaini take a look to http://geo-gvnix.rhcloud.com/pets?page=1&size=10 I think it is the feature you are looking for.

@frnore gvNIX has this feature, gvNIX lets you to define any type of "master- detail" view patterns using the datatables component.

Tumaini, thanks to Curt Huffman ( https://github.com/Cujo13 ) there is an alpha version of the documentation in english. Yo can download it from https://github.com/gvSIGAssociation/gvnix/issues/23 , then read the section "2.10 Step 8: Screen Patterns" to learn how to implement the screen pattern you need.

Another sources of documentation are the quickstart applications that you can found at https://github.com/DISID/gvnix-samples/

May the Force be with you.

This functionality is not implemented yet on gvNIX. I'll guide you about how to implement it but I can't give you the specific resolution.

To implement this, you must add some code on your file ~/webapp/WEB-INF/views/invoices/ create.jspx to add a new InvoiceItem field on Invoice creation page.

Then you must push-in the method InvoiceController.create from InvoiceController_Roo_Controller.aj and edit it to handle the input from InvoiceItem field so that it will take the identifier from new Invoice record created and use it to create a new InvoiceItem record also.

Here is a sample project that implements an example of this functionality: https://github.com/frnore/gvnix-sample-detail-creating

I hope be helpful. Best regards.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM