Limit References Added to Reference Grid

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
customaware
Posts: 2405
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Limit References Added to Reference Grid

Post by customaware »

Imagine I have a Parent BO and it OWNS Many Child BO.

On the Parent form I have a Child Grid.

I have a Panel Operation for Add New Child Reference on the bottom Panel of the Child Reference Grid.

In the Parent I have an Attribute... ChildLimit.... Assume it is set to 2

Hence, the user can add 2 Child records but as soon as 2 records have been added, I want the Add New Child Reference button to disappear.

I have Child count in the parent and use a visibility condition on the button but cannot get it to disappear dynamically. Only tests the button visibility when the form is opened.

Any ideas?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
hpl123
Posts: 2598
Joined: Fri Feb 01, 2013 1:13 pm
Location: Scandinavia

Re: Limit References Added to Reference Grid

Post by hpl123 »

eagles9999 wrote:Imagine I have a Parent BO and it OWNS Many Child BO.

On the Parent form I have a Child Grid.

I have a Panel Operation for Add New Child Reference on the bottom Panel of the Child Reference Grid.

In the Parent I have an Attribute... ChildLimit.... Assume it is set to 2

Hence, the user can add 2 Child records but as soon as 2 records have been added, I want the Add New Child Reference button to disappear.

I have Child count in the parent and use a visibility condition on the button but cannot get it to disappear dynamically. Only tests the button visibility when the form is opened.

Any ideas?
Not sure how the Aware visibility conditions work but I imagine it´s only CSS based which means you can use JS to manipulate it yourself and when you manipulate the DOM and CSS it is dynamic i.e it happens when you do the change with no form refresh etc. required. Adding and removing CSS classes via jQuery is one way and something I have used in Aware apps before:
https://api.jquery.com/addClass/
https://api.jquery.com/removeClass/
Henrik (V8 Developer Ed. - Windows)
himanshu
Posts: 723
Joined: Thu Jun 19, 2008 6:24 am
Location: India
Contact:

Re: Limit References Added to Reference Grid

Post by himanshu »

Hi Mark,

Try this..

- Create a new attribute in Parent call MaxChildRow [Number].
- Update this attribute value when a new child row added.
- Put condition on the Add New Child Button If MaxChildRow < 2

- You can create another attribute to make more dynamic CurrentTotalRows..

Let me know if this help
From,
Himanshu Jain


AwareIM Consultant (since version 4.0)
OS: Windows 10.0, Mac
DB: MYSQL, MSSQL
tford
Posts: 4238
Joined: Sat Mar 10, 2007 6:44 pm

Re: Limit References Added to Reference Grid

Post by tford »

I have a VP with a form of RegularUser named "Filter Students". The form auto-refreshes on changes to RegularUser as well as some processes also.

This is part of the filter:
Filter.jpg
Filter.jpg (11.35 KiB) Viewed 5056 times
"Clear Filters" is an HTML cell on the "Filter Students" form:
<div style="background: #ffff00;"><a href="#" onclick="AwareApp.startProcess ('Totals__Filters_Clear','main')" title="Click to set filters to: All" ><<LoggedInRegularUser.Selected_Filter>></a></div>

These two rules work together to make the "Clear filters" link appear and disappear:


If RegularUser.Selected_Grade<>'All' OR RegularUser.Selected_School IS DEFINED OR RegularUser.Selected_FeederYN<>'All' OR RegularUser.Selected_PSD_Intent<>'All' OR RegularUser.Selected_TestedYN<>'All' OR RegularUser.Selected_Admitted<>'All' OR RegularUser.Selected_ShadowYN<>'All' OR RegularUser.Selected_HA_InvYN<>'All' OR RegularUser.Selected_ClevelandYN<>'All' OR RegularUser.Selected_T_500_Reenroll_Status<>'All' OR RegularUser.Selected_AppliedYN<>'All' Then
RegularUser.Selected_Filter='Clear Filters'
Else
RegularUser.Selected_Filter=UNDEFINED


If RegularUser.Selected_Filter<>'Clear Filters' Then
READ PROTECT RegularUser.Selected_Filter FROM ALL
Tom - V8.8 build 3137 - MySql / PostGres
Post Reply