|Some questions on hierarchical editable TablePage [message #1797691]
||Mon, 05 November 2018 09:17
| The Maddes
Registered: October 2018
it's me again.
Thanks to Patrick i managed to make progress in my application and build a lot of tables, forms etc.
Now i came to a point where i cannot find any solution and would highly appreciate some advice from the pros :)
1. I have a HIerarchical Tablepage which is called from an TabBox.
The page gets rendered nice and the hierarchy is working as expected, all data is coming from the database.
Now what i want to achieve is:
I want to have an empty row under each parentrow, if there are children or not.
This row should represent a child which might or might not be edited and saved to the database afterwards.
How can one achieve this?
2. This leads me to the second question. This hierarchical table should have all children rows with some editable fields in the table. I just didnt find a documentaion on how to save changes made in an editable table. I think there needs to be some kind of listener that queues up the changes of each row and then sends it to the service to update/insert those changes. Is there anything out of the box or what would be the best way to do this?
I'm sorry if my questions might have been answered already, but i didn't find a working solution for my case.
Thank you in advance!
Maybe it is best if i tell you what my goal is.
I want to have some kind of timemanagement where each day is represented in a tab, and each tab has a tablepage showing the informations for that day in which the user can enter/edit data for that specific time. So maybe its easier to eventually see it as a whole.
[Updated on: Mon, 05 November 2018 10:53]
Report message to a moderator
|Re: Some questions on hierarchical editable TablePage [message #1797957 is a reply to message #1797853]
||Fri, 09 November 2018 08:52
| Patrick Bänziger
Registered: September 2011
It depends a bit on where your table is located and what your desired outcome is, especially when the changes in the table should be saved.
Let's assume that your editable table is located in a form with a "Save" Button. When adding, editing and removing rows in a table, Scout updates the status of the row ( ITableRow.getStatus() ; See ITableRow for all status codes).
Scout also does not really remove rows by default, it just marks them as deleted - which allows you to also handle these later. (Note: The "Discard" function on the other hand will remove the deleted rows immediately).
Now, if you wish to store changes that you made in your editable table when the user clicks "OK" to close the form and you are using the standard pattern of using exportFormData(...), you can loop over all rows in the service where you process the save action.
Using the status, you can detect what the user did with the row and add, alter or remove the corresponding rows in the database.
(You can see a possible implementation - without editable rows - in the events demo app: FormCode and backend code and the online demo (choose "events")
Regarding your request for "empty rows" - you can handle this either on the client or server side and insert the appropriate rows where desired.
Note: On Import of a FormData, all row states are set to "STATUS_NON_CHANGED".
A typical implementation either uses a "add row" context menu to let the user manually add a row at or listens to table changes to ensure there is at least one empty row to fill.
Personally, I recommend the first one - it's simple and reliable. The second one tends to be harder to implement and more error-prone.
Does this about cover your question or did you have something else in mind with your design?
|Re: Some questions on hierarchical editable TablePage [message #1798070 is a reply to message #1797985]
||Mon, 12 November 2018 08:13
| Beat Schwarzentrub
Registered: November 2010
The Maddes wrote on Fri, 09 November 2018 09:25|
What i want to do is:
Have a dynamic outline which creates and entry for each year from 2018.
Each year should have childpages of each month.
If i click on an outline of a month, i want to render tabboxes for each day of the month, these tabboxes should not be closable.
You can use node pages or table pages for your year / month data. With node pages you generate your dynamic nodes in execCreateChildPages(), with table pages you create the data in execLoadData(). For your use case, table pages are probably the better alternative. They are more flexible and allow multiple columns (e.g. you could display the months total).
The "month" page should be marked as "leaf" and provide a detail form. This form then contains your tab boxes with table fields etc. You can also consider using only one table and switch the day using buttons, a text field or a smart field.
I thought the ideal design would be a tablepage which has editable columns as needed. But i only found a way on overriding the pageDeactivated method to save changes to a tablepage.
You can handle changes in editable cells by overriding the method execCompleteEdit() on the corresponding column. You should probably store every change at once. As you have notices, table pages not really have a life-cycle, they just "exist". So when you are holding non-persisted data in them, you need listeners for all events that cause the page to be removed (can happen if you go up one level and "refresh" the list). Or you add an explicit save button and leave it to the user to press it...
For practical reasons we recommend using forms to collect and store data. They require one more user action to start, but they have a proper life-cycle and are therefore much clearer to use.
Powered by FUDForum
. Page generated in 0.02499 seconds