Solved

Header/ Details Form

  • 26 October 2018
  • 4 replies
  • 11 views

Badge +4

Hi All,

I am new in K2.

 

 I have designed two list views. one for Header (Parent) and another for Details (Child).

Header view has a button.

 

i would like to achive

1. select one row of the Header view and on pressing the button, the Details view will open to display the details of the selcted parent.

2. Validations : Pressing button will display an error message if no row is selected or more than one row is selected.

 

Thanks with Regards,

JD

icon

Best answer by RaymondJVR 30 October 2018, 12:35

View original

4 replies






Good day 

Regarding point 2, validation i have provided you with a link that will assist you with vaildation steps, please see:


 

 

K2 will not accept any liability for any issues arising from actions taken in respect of the information provided by any forum member.


 





 
Badge +9

Hi JD1,


 


I was not able to find any Rule / Condition for your scenario, but what you can try is the following:


 


1. Disable the Button on the Header view, and then have a Rule that enables the Button when the Header List ececutes the "List Item Click" Event, this should prevent users from selectin the button without selecting anything in the list.


 


2. On the Header ListView, click on the ViewSettings and disable the "Multiple Row Selecting" in the Runtime Options page


https://help.k2.com/onlinehelp/k2five/userguide/5.1/default.htm#Create/Views/ListViewSettings.htm


 


-Jean

Userlevel 4
Badge +13

Hi JD1


 


Based on the request in this post I can see that you plan on opening the relevant details (child) data for the selected parent item. For a basic solution I would recommend providing the Child SmartObject with a column dedicated to the Parent. This will allow the child to identify which content to display based on the selection made in the parent window. For this you would need to also make use the "open a subview and execute a method" rule which will do the relevant filtering in order to return the correct results. Please see the below step by step on how to get this setup.


 


Step by Step | Based on you scenario, you can start following the steps from step 2:


1) Create a SmartObject called Parent, provide it with the following properties and data types:



  • Name (Text)

  • Surname (Text)

  • Please take note of the ID property that would have been created manually when the SmartObject was created



 


 


2) Create another SmartObject called Child, Provide it with the following properties and data types:



  • Parent ID (Number)

  • Age (Number)

  • Telephone (Number)


 


 


3) Generate or create an Editable List View for each of the created SmartObjects.


4) Run the parent Editable list view and add some data.


5) Run the child Editable list view and add some data. Note on the Parent ID, you will need to provide the ID of the record in the Parent which will allow the Parent ID column to be used as a foreign key allowing you to have value to return specific records with.


 


6) Edit the Parent Editable list view, hide all the unrequired buttons and do the following:



  • And add your own button and set it to disabled

  • Configure the button to open the child editable list view as a subview and execute its get list method.

  • Further configure the rule by adding a filter which would filter where the child Parent ID column is equal to the ID column from the Parent.



 


7) Now add another rule "When parent view executes list item click" and do the following:



  • inside of the when item is clicked rule, call the "enable a control" rule and set it to enable the button that had been disabled in step 6



 


8) Save, Finish, Run the Parent, select a record in the parent list - You will see the Child popup and display the data only relevant to that specifically selected parent record.


 


Should you feel that this post is of use and or an accurate solution to the raised question, I kindly encourage you to mark it as such using the 'Mark as Solution', 'Kudo' andor Me Too options.


 


Kind Regards


Raymond

Badge +4
Hi Raymond,
Thank you very much for your effective solution and it is very much appreciated they way you have describe steps.

Thanks with Regards
JD

Reply