allenchow Posted July 31, 2018 Share Posted July 31, 2018 Is it possible to change the font color of tabsheet for different condition? e.g. when some value > 0 or value = 0 I've tried using something like : if s > 0 then UniSession.AddJS(UniTabSheet4.JSName + '.tab.btnInnerEl.setStyle("color", "#008000")') else UniSession.AddJS(UniTabSheet4.JSName + '.tab.btnInnerEl.setStyle("color", "#000080")'); But it will show error : Cannot read property 'btnInnerEl' of undefined Cannot read property 'btnInnerEl' of undefined Link to comment Share on other sites More sharing options...
Sherzod Posted July 31, 2018 Share Posted July 31, 2018 Hi, It should work. Which build are you using? Where do you use this code? Link to comment Share on other sites More sharing options...
allenchow Posted August 1, 2018 Author Share Posted August 1, 2018 The latest build. I think the problem is I put the code under a table afterscroll and check the value of current records. Maybe there are too many records inside the table, it gives me the error, and I dound the error contents are very long (with all record datas inside ) !!! Link to comment Share on other sites More sharing options...
Sherzod Posted August 1, 2018 Share Posted August 1, 2018 Hi, If possible, make a simple testcase, we will check.. Link to comment Share on other sites More sharing options...
allenchow Posted August 1, 2018 Author Share Posted August 1, 2018 Similar like this one Project1.zip Link to comment Share on other sites More sharing options...
Sherzod Posted August 1, 2018 Share Posted August 1, 2018 In your case a dirty workaround: procedure TMainForm.ClientDataSet1AfterScroll(DataSet: TDataSet); begin try if ClientDataSet1.FieldByName('TaxRate').AsInteger = 0 then UniSession.AddJS('try {' + UniTabSheet1.JSName + '.tab.btnInnerEl.setStyle("color", "#008000")} catch(err){}') else UniSession.AddJS('try {' + UniTabSheet1.JSName + '.tab.btnInnerEl.setStyle("color", "#000080")} catch(err){}'); except // end; end; Link to comment Share on other sites More sharing options...
allenchow Posted August 2, 2018 Author Share Posted August 2, 2018 OK ~THX Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now