Dynamic Row Colour Change when a field is changed
Toddy_Boy
Member Posts: 232
Has anyone managed to change the colour on a repeater row when a field on that row is amended? e.g. I want to change the StyleText of the fields from Attention to Standard (and reversed) based on an option field value which can be edited on the row.
Life is for enjoying ... if you find yourself frowning you're doing something wrong
0
Comments
-
OBJECT Table 50000 Style Test { OBJECT-PROPERTIES { Date=15-10-28; Time=12:10:51; Modified=Yes; Version List=; } PROPERTIES { } FIELDS { { 1 ; ;Code ;Code20 } { 10 ; ;Description ;Text30 } { 20 ; ;StyleText ;Text30 } } KEYS { { ;Code ;Clustered=Yes } } FIELDGROUPS { } CODE { BEGIN END. } } OBJECT Page 50000 Style Test { OBJECT-PROPERTIES { Date=15-10-28; Time=12:14:49; Modified=Yes; Version List=; } PROPERTIES { SourceTable=Table50000; PageType=List; OnAfterGetRecord=BEGIN SetLineStyle(); END; OnNewRecord=BEGIN LineStyle := 'Standard'; END; } CONTROLS { { 1220060002;0;Container; ContainerType=ContentArea } { 1220060003;1;Group ; Name=Group; GroupType=Repeater } { 1220060004;2;Field ; SourceExpr=Code; StyleExpr=LineStyle } { 1220060005;2;Field ; SourceExpr=Description; StyleExpr=LineStyle } { 1220060006;2;Field ; SourceExpr=StyleText; OnValidate=BEGIN SetLineStyle(); END; } } CODE { VAR LineStyle@1220060002 : Text; LOCAL PROCEDURE SetLineStyle@1220060003(); BEGIN CASE StyleText OF 'Favorable': LineStyle := 'Favorable'; 'Unfavorable': LineStyle := 'Unfavorable'; ELSE LineStyle := 'Standard'; END; END; BEGIN END. } }JEREMY VYSKA
CEO, Spare Brained Ideas, Göteborg, Sweden
New (April 2021) Getting Started with Microsoft Dynamics 365 Business Central Book Available: "Your First 20 Hours with Business Central"0 -
That's the solution I came to however it didn't work.
I've done some further investigation, I'm trying to get this working on the Sales Order Subform (46), when the option field is changed the style is changed correctly, but when I move off the line the style reverts to it's previous style. Maybe something to do with a refresh?Life is for enjoying ... if you find yourself frowning you're doing something wrong0 -
Hi,
Cant try it right now but try:
* Moving your Code into the onAfterGetCurrRecord Trigger,
if that doesnt work
* Return your LineStyle from your function, and call the function directly in the StyleExpr attr.
Regards WisaAustrian NAV/BC Dev0 -
No joy sadly, I get an Unknown function type errorLife is for enjoying ... if you find yourself frowning you're doing something wrong0
-
Further playing about, the above by JDVyska works if the RefreshOnActivate set to Yes, however it doesn't for my Sales Order Lines subpage issue.Life is for enjoying ... if you find yourself frowning you're doing something wrong0
-
Got there, if the OnValidate trigger looks like the statements below then it works.

CurrPage.SAVERECORD; CurrPage.UPDATE(FALSE); SetTextStyle;
However, when i now try the same approach on a different page I can get the other fields in the repeater to change colour but not the option field I'm amending.
Life is for enjoying ... if you find yourself frowning you're doing something wrong0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 322 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions