TableField in Form [message #1800963] |
Thu, 10 January 2019 07:00  |
Eclipse User |
|
|
|
Hey guys happy new year!
New year, new questions.
So i dont get how i can get this to work.
I have a button to load a new form.
This form now needs to be an editable table.
So far so good.
What i dont get is how can i achieve that the table gets populated with (if) existing data from a database.
And i need to save the newly added rows to the database. I think this can be done with the row_state.
Maybe it is a little confusing, because to me the table belongs to the form. The form has no other fields than the tablefield. So what kind of service / dataprovider do i need to implement?
I was reading about that here:
https://wiki.eclipse.org/Scout/Concepts/TableData#Bean_based_TableData
What i dont understand is, theres an extra FormData Annotation for the table, but i dont see how to work with that data over the formhandler services.
I hope it is somehow understandable what i want to achieve.
Form with an editable table that can be stored to the database and also filled by the database.
Thank you for any kind of input!
|
|
|
|
Re: TableField in Form [message #1801019 is a reply to message #1800964] |
Fri, 11 January 2019 04:06   |
Eclipse User |
|
|
|
Hey Matthias,
you were guessing absolutely right.
So far i implemented the table and i can access it.
But i have a question regarding the Database handling.
So if i want to save x rows, it seems like i have to do sth like that:
MyTableRowData[] formRows = formData.getMyTable().getRows();
for (MyTableRowData row : formRows) {
if(ITableBeanRowHolder.STATUS_INSERTED == row.getRowState()) {
SQL.insert(SQLs.INSERT_STATEMENT
, new NVPair("value1Formdata", formData.getValue1())
, new NVPair("valueXFormdata", formData.getValueX())
, new NVPair("valueXRowData" row.getValueX())
, row);
}
}
To me it seems thats not the best way to achieve the desired result.
[Updated on: Fri, 11 January 2019 04:06] by Moderator
|
|
|
|
Re: TableField in Form [message #1801117 is a reply to message #1801026] |
Mon, 14 January 2019 03:44  |
Eclipse User |
|
|
|
Hey Matthias,
thank you :) So i guess i will just stick to that way and build it like that, its just a little more of coding but thats no problem at all.
I was just thinking that there might be something handy im missing out on.
But anyways, thank you again for your input!
|
|
|
Powered by
FUDForum. Page generated in 0.05412 seconds