0

I started to work with Serenity a couple of days ago and i got stacked by a small problem.

I have a grid made by a view of 2 Tables and i would like to add the values from that grid in those tables.

I know that i can not add from view directly and i need to create some functions which will add those items in the right place in those tables.

This is an example of the schema:

enter image description here

I created a view so the grid will be displayed with columns from both tables.

This is an example of the grid:

enter image description here

Serenity is great tool if you want to build an app very quick but is not very user friendly if you want to modify something in the code that is generated.

I tried to add some functions from StackOverflow, but that will modify the entire functionality of the program and this type of request is used only once. I can not modify the default create function, because for the rest of the tables this function will be useless.

If someone tried to work with Serenity and have an idea please give a hint so I can resolve this issue.

Thanks!

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • I don't think I fully understand the question. Are you trying to edit the data on the list screen? – Mark Ewer Jun 09 '16 at 10:16
  • Thank you. I resolved that issue and not everything is fine. The problem is that you can not insert in 2 tabels from a view using this Framework. In case someone needs you need to use getDialogType() and add another table in the form. – Alexandru Florin Jun 10 '16 at 13:28
  • True. This framework makes some strong assumptions about the database and ui. It can make you very productive if you can shoehorn your app into those assumptions but it slows you down when you need to deviate. – Mark Ewer Jun 10 '16 at 15:11

2 Answers2

1

Serenity is great and I thank the guy. For those who may hit this thread don't give up. Check the current documentation. I have a few points that may be of help to those who follow. I had a proper db with foreign keys and stored procs that I wished to use to improve performance. I also had model classes mapped to the procs representing the objects I wished to use which routinely include multiple tables joined in the procs.

I found that Serenity included the joined table columns in the entity row class but not in the columns class and the row class property was attributed with the Expression tag which I removed. I believe I saw a comment from the author that he uses the foreign key declarations for this purpose.

I my case I was able to add a property to the columns class.

In the endpoint class I retrieved my proc results into my domain objects and then populated a list of the row class instances and added that list to the method return object.

This process resulted in a properly populated grid object.

Had I known how this worked to start with, it would be better to populate the list of row class objects directly.

Hope this helps.

Doyle
  • 81
  • 7
0

Serenity allows updating two tables at once, there is even a sample for this in Customer dialog. At the bottom, Customer Details are listed from and updated on a separate table.

Serenity doesn't make assumptions about your UI or tables, unlike Mark Ewer states. I use Serenity on so many different legacy applications and databases, so it has to adapt to any DB structure.

Of course, because code generator handles simple cases, generating UI for a simple table is easier. For more complex cases, you should know where to inject the plug. Thats where samples, docs and GitHub issues comes in.

Volkan Ceylan
  • 1,486
  • 13
  • 15