Hi Guys!I have a parent WebBlock "WebBlock 1" that sends data to the child WebBlock "WebBlock 2", but I have a delete and save button that is in the parent WebBlock but the information that I need to save or delete are inputs that are edited by the user and these inputs are in the child WebBlock, I don't know how to return this data because I can have up to 100 entries because they are in a list and I have no way to put them an event for the inputs.WebBlock needed to be dynamic and the list return a format that I tried other ways but it is a list within another list and in this case only the second list would be edited.I apologize for sending prints because it's the company's project.
I'll explain your requirement with an example as I understand it. WebBlock 1 sends a list of employees with attributes like Id, Name, and Date of Hiring to WebBlock 2. In WebBlock 2, the employees are displayed, allowing users to update an employee’s Name or remove an employee. When the Save button is clicked in WebBlock 1, it needs to determine which employee records have been modified or removed. Based on this I propose the following.
One possible solution is for WebBlock 2 to raise an event with the updated list of employees. WebBlock 1 keeps a local copy of the original list and maintains a modified version of the list as changes occur. When the Save button is clicked, WebBlock 1 compares the original list with the modified list to identify changes and take the necessary actions. This approach is straightforward but requires maintaining three copies of the data: the original list, the modified list in WebBlock 1, and the active list in WebBlock 2.
Another option is for WebBlock 2 to raise two separate events: one when an employee's details are modified, passing only the updated employee record, and another when an employee is deleted, passing just the primary key of the removed record. WebBlock 1 then maintains two separate lists, one for modified employees and another for deleted records. When Save is clicked, WebBlock 1 processes these lists to apply the necessary updates. This method is more efficient as it avoids unnecessary duplication and tracks only the required changes dynamically.
Hi Fabiano Ferreira ,To return the modified data from WebBlock 2 to WebBlock 1, used an event: 1.Define an Event in WebBlock 2:Create an event (OnChange) in WebBlock 2 to send the updated list back to WebBlock 12.In WebBlock 2, define an event to send the updated list back to WebBlock 1.3.Store Edited Data in a Local Variable in WebBlock 24.Trigger the Event on Save/Delete 5.Handle the Event in WebBlock 1 Thanks,Sahana
Hi @Fabiano Ferreira
I understand your requirement that you have list of record (Data) in Child block, and you have save or delete button in Parent Block for saving function you need those data...Its correct right?
To achieve
Try this method and let me know whether it helpful for your requirement or not.
Thank you,
Duraikannan.
Hi,
It looks like you try to implement a grid pattern using a list of blocks. This is hard to implement and keep it performance because yo need to firing of a lot of events.
Consider using the outsystems Grid, or other Grid Forge components, that already imement he behaviour you now try to built yourself.
Regards,
Daniel
Aggreged with @Daniël Kuhlmann, you should try grid. Managing too many blocks is very complex.
You need to be very careful else it will be a performance problem for the application.
Hi Fabiano Ferreira,
Hope you are having a good day.
Seems what you are trying to implement is already there as forge component in outsystems.
you can learn more about this here:https://www.outsystems.com/forge/component-overview/9764/outsystems-data-grid-o11
This is a outsystems supported asset so you can integrate it with your app without any issues. you will also find many docs on how to use it.if what you are trying to build is different then you can create a discussion where we would love to help you more.Cheers,
Mukul Singh Nathawat
Thanks guys!
I started the project, this grid format had already been developed and I needed to deliver the project on Friday, so I chose to create the lists and events in onchange, always keeping the list updated in both blocks, I know it takes a greater toll on performance, then I'll check a grid in forge to improve.