0

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 Kilimba
  • 195
  • 2
  • 15

2 Answers2

1

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.

eruiz
  • 1,963
  • 1
  • 14
  • 22
  • hello eruiz, I have looked at http://geo-gvnix.rhcloud.com/pets?page=1&size=10 but that is not what am looking for. I have 3 entitites, Invoice, Item and Invoice Item. An invoice can have many Items. gvNIX/Roo creates CRUD pages for `Invoice`, `Item` and `InvoiceItems` which means when I finish creating an Invoice, I have to navigate to the `InvoiceItem` `create.jspx` to add an `Item` to an `Invoice`. I am asking if it is possible when I am on the `Invoice` `create.jspx` it allows me to add `Items` on the _very_ _same_ _page_.I hope this is a bit clearer? frnores answer is on the correct path – Tumaini Kilimba Jan 12 '16 at 09:11
  • Ok, I see, so something like this http://viralpatel.net/blogs/spring-mvc-multi-row-submit-java-list/ could be useful for you. Just add the fields of the Invoice inside the form to submit all the data in only one request. Good luck. – eruiz Jan 12 '16 at 20:16
0

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.

frnore
  • 111
  • 4
  • Would it be possible to share some code which achieves this? Am still quite new to Spring and Roo, so a first example would really help me to continue the rest on my own. Thank you – Tumaini Kilimba Jan 11 '16 at 09:49
  • I have written an example about how to create an InvoiceItem when creating an Invoice as you need. Note that I am only creating an InvoiceItem record each time I save a new Invoice, you must customize the code to allow select more than one Item. **I'll edit my answer above with a link to the sample project**. Please, accept my answer if it works. Regards. – frnore Jan 11 '16 at 16:07
  • Tumaini please, accept the answer if it was helpful. – frnore Jan 13 '16 at 10:42
  • I promise I shall, I just have not yet had time to go through it yet but I will by end of today, and update the thread with any actions or comments necessary – Tumaini Kilimba Jan 13 '16 at 10:45
  • I have tried to create your application using your `log.roo` file, but the resulting web application has errors :-( – Tumaini Kilimba Jan 13 '16 at 13:42