Question

Conditional Style on Calendar when empty

  • 16 November 2020
  • 6 replies
  • 67 views

Badge +8

Having issues with the Calendar control and a conditional style.

When empty -  red border

When not empty - no border

 

This has worked in the past but it’s being very flaky.

 

Default value is = Empty

 

So doing conditional styling you’d think I could do

When Control is Empty - red border

When Control is not empty - no border

 

But it’s acting as if there is a value in there upon first initialization.

 

 


6 replies

Userlevel 1
Badge +2

Hi, AAshenbrener,
 

You could create rules to action on these and change the properties of the control, this would be the fix that I can think of to the flakiness of the control.

Please, let me know if this helps and if you need help with the rules.

Regards,
Kevin Zhou

Badge +8

I’ve tried that too - when setting the properties of the Calendar Control -  Styles & Conditional Styles aren’t an option for me to select.     We have always done a conditional style on the control itself but for some reason on one control (view 1 on form) it works and on the other (view 2 on the form) it doesn't.

 

Userlevel 1
Badge +2

Could you tell me which rules you’re using to accomplish this?

Also which version of K2 you are working on.

 

Regards,
Kevin Zhou

Userlevel 2
Badge +5

Hi @AAschenbrener ,

 

I have created 1 condition (Border), and kept the Defualt one as well:

 

Border setting, when the control is empty, it will have a red border, else it will revert to the defualt condition style. So on page load it will have a red border, once the control is populated, it wont.

 

Hope this helps

 

Kind Regards

Prineel

Badge +8

Yeah - it’s weird - I’ve done this for 2 years. Same condition / same rules. 

It will work one time and then not then next.  

Absolute SAME Condition styles as Prineel has.

 

You can see - the field is empty -  it should pick up that rule.

 

 

Userlevel 2
Badge +5

Hi @AAschenbrener ,

 

I honestly have no idea why its doing that. I think your best bet is to log a support ticket and hopefully they will be able to figure out why its not working, but before you do that, perhaps try a few more things:

  1. In your “when view excecutes initialize” rule, use the “set the properties of a control” rule and set the properties of your calendar control as such:
Simply tick the defualt value (as empty)
  1. Reomove your “not empty” conditional format and see test it with just the defualt and the “empty” conditional format.
  2. Maybe test the “is not empty” conditional format and see if displays the border and switch the rules around (this most likely will not work, but its worth a shot).

Good Luck!

 

Kind Regards

Prineel

Reply