MOGSY Posted May 4, 2021 Share Posted May 4, 2021 Hi I would like to change the font colour and background colour of a cell in UniDBGrid on client side depending on the value of a cell. The cell font colour may change just depending on how long the grid is displayed. I cant use OnDrawColumnCell since that event is fired when the underlying data has been updated. Here the data is not changing just the fact that time is passed the font colour of the cell need to be changed. Also I prefer not to update the whole Grid just the a specific cell. Thanking you in advance. Regards. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 4, 2021 Share Posted May 4, 2021 4 hours ago, MOGSY said: Here the data is not changing just the fact that time is passed the font colour of the cell need to be changed. Hello, Can you please explain in more details? Quote Link to comment Share on other sites More sharing options...
MOGSY Posted May 4, 2021 Author Share Posted May 4, 2021 Hi Sherzod I have a UniDbGrid with one field is date and time, what I need to do is if the record has not been modified for a defined period, I need to give the users feedback with change of colour of the field. However I do not want to keep retrieving data from the server and do the update on refresh, since the screen will flicker also avoid unnecessary server request. I would like to do this on the client side since no new information required from the server nor it needs to update anything. Regards Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 4, 2021 Share Posted May 4, 2021 1 hour ago, MOGSY said: Hi Sherzod I have a UniDbGrid with one field is date and time, what I need to do is if the record has not been modified for a defined period, I need to give the users feedback with change of colour of the field. However I do not want to keep retrieving data from the server and do the update on refresh, since the screen will flicker also avoid unnecessary server request. I would like to do this on the client side since no new information required from the server nor it needs to update anything. Regards Hello, If I can suggest you to use HTML in SQL query, like this: SELECT CASE WHEN sDateField between '' and '' THEN '<p style=background-color:red;>' + YourColumn + '</p>' WHEN sDateField between '' and '' THEN '<p style=background-color:green;>' + YourColumn + '</p>' ELSE sDateField between '' and '' THEN '<p>' + YourColumn + '</p>' END FROM You table Quote Link to comment Share on other sites More sharing options...
MOGSY Posted May 4, 2021 Author Share Posted May 4, 2021 Hi The issue with that is, it is OK for when data is fetched from the server, however as the time passes the colour remain the same. What is required is as the time passes the colour should change, so for example if 10 minutes passed the font colour could be yellow and after 20 minutes changes to red. Regards Quote Link to comment Share on other sites More sharing options...
irigsoft Posted May 4, 2021 Share Posted May 4, 2021 12 minutes ago, MOGSY said: Hi The issue with that is, it is OK for when data is fetched from the server, however as the time passes the colour remain the same. What is required is as the time passes the colour should change, so for example if 10 minutes passed the font colour could be yellow and after 20 minutes changes to red. Regards OK, how to activate event to redraw colors ? What will fire refresh event ? Timers or every redraw of the form/components ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.