send data to a modal . How to do that

Hello, 


I have made a modal with a block into it. 

Now I trying for 2 days how I can send a customerId to the modal/block so I can show there the customer data. 


So please some hints 


Roelof


Solution

Hoi Roelof,


I had a look at your oml, I had to remove some unknown client actions from your LayoutBase to be able to publish, so please if you still need those, just look at what I changed and copy it over into your complete module.

there are a number of basic problems :

- on the screen, you have a table records inside a list, just choose one.

- on the screen, in the handler of the block event, add a refresh to see the changes just made

- in the block, you can see this warning, it means that opening the popup with the block will not show the new details, unless you refresh the details of the block based on the id passed in.

so you need to add the onParametersChanged event and refresh the blocks aggregate :

- But that still won't show the correct details, because you are always passing nullidentifier to the block :

What you want is to pass either the nullidentifier, when user clicks add button, or the id of the current row in the table when user clicks one to edit.  You could do that by adding a new local variable 'SelectedCustomer', and pass this one to the webblock.  Set it to nullidentifier in NewCustomerOnClick and set it to current.customer.id if user presses link on one of the customers in the table.


Hope this helps you forward,

Dorine

when

Solution

Thanks, but that is just the part I do not see how to parse the SelectedCustomer to the webblock 

Roelof Wobben wrote:

Thanks, but that is just the part I do not see how to parse the SelectedCustomer to the webblock 

Look at the properties of the webblock inside your screen.  You are now passing nullidentifier, that should be selectedcustomer

In action to edit an existing customer, before showing the popup, set selectedcustomer to the id of the one currently selected in the list.

In action to add a new customer, before showing the popup, set selectedcustomer to nullidentifier


As the id being passed in changes, the OnParametersChanged of the webblock will go off, refreshing the form details.

Thanks,


Next step, Use what I learned now to do the same but then with subscriptions