Jump to content

how to change TUniCalendarPanel day cell background color


Freeman35

Recommended Posts

Hello,

In V1420, I wanna change DayCell background color. I found this link in forum (Thanks to Muhammed)

http://forums.unigui.com/index.php?/topic/7893-calendarpanel-event-back-color/?hl=calendarpanel

 

You can use css "#", every cell has an ID, for example for cell: 05/02/2017:

#O13_id-month-day-20170205 {
background-color:#f00 !important;
} 

013 = UniCalendarPanel1.JSName

 

so you can use #id and assign css class as the color you want.

 

on my project :

#O12B_id-month-day-20171111 {
 background-color:red !important;
}

This work me. But, I have do change this css in runtime, becouse user can change year to any time, so no good idea add defined css file. I need for just mountview.

How to change TUniCalendarPanel's DayCell background color, And not all cell, If my condition result true (Exaple if daycell itemcount>0) then backround color will change

Thank you

 

Link to comment
Share on other sites

Hi,

 

But, I have do change this css in runtime

 

I think, you can try to use:

 

"Ext.util.CSS.createStyleSheet" and "Ext.util.CSS.removeStyleSheet" for example...

UniSession.AddJS('Ext.util.CSS.createStyleSheet("'+
  '#O12B_id-month-day-20171111 {' +
  '  background-color: green !important;' +
  '}")');
Link to comment
Share on other sites

Thank you so much, but have a problem. Please look at to screenshot. That Screenshot after use "removeStyleSheet". All style property removed.

 on this link I found

http://www.objis.com/formationextjs/lib/extjs-4.0.0/docs/api/Ext.util.CSS.html
 

updateRule( String/Array selector, String property, String value) : Boolean

Updates a rule property

 

Can be use this methot? if yes how to? I'm sorry I don't know javascript (I hope yet)

Thank you.

post-4508-0-76692400-1510314676_thumb.png

Link to comment
Share on other sites

For Add:

UniSession.AddJS('Ext.util.CSS.createStyleSheet(" #'+UniCalendarPanel1.JSName+'_id-month-day-20171111 { background-color: green !important;}", "_20171111_")');

For remove:

UniSession.AddJS('Ext.util.CSS.removeStyleSheet("_20171111_");');

Thank you very much.

 

Just for learn, If I wanna write code in delphi

 

if  Ext.util.CSS.getvalue("_20171111_")

then UniSession.AddJS('Ext.util.CSS.updateRule("#'+UniCalendarPanel1.JSName+'_id-month-day-20171111","background-color","'+'red'+'");')

else UniSession.AddJS('Ext.util.CSS.createStyleSheet(" #'+UniCalendarPanel1.JSName+'_id-month-day-20171111 { background-color: green !important;}", "_20171111_")');

 

how to write this code in java script ?

Best regards.

Link to comment
Share on other sites

  • 11 months later...
  • 5 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...