Guest Posted February 27, 2011 Posted February 27, 2011 Message from: "Simon Benedicic" Hi Farshad, When I read complaints about UniDBGrid and conditional painting of grid cells, I wonder if it would be possible to implement client only fixed conditional painting javascript. Below is the code I am using in pure ExtPascal project. Painting function is named ColorValue which is containing some JavaScript and is later assigned to PROJECTED_BUDGET COLUMN using RendererExtFunction. var ColorValue : TExtFunction; // Function for conditional painting of column ColorValue := JSFunction('V', 'if(V<400000){return " style=''color:green''>" + V + "";}else ' + 'if(V>400000){return "" + V + "";}' + 'return V;'); // Grid columns with ProjectBudgetGrid.AddTo(Items) do begin with TExtGridColumn.AddTo(Columns) do begin Id := 'PROJECTED_BUDGET'; Width := 100; RendererExtFunction := ColorValue; end; end; Best Regards, Simon . Quote
Guest Posted February 28, 2011 Author Posted February 28, 2011 Message from: "Farshad Mohajeri" Hi, The slowness is actually related to the client side javascript. Ext JS has a somehow complex method of handling cell coloring. I will work on code to further optimize it or rewrite some part of it where possible. Actually, changing the background color is what makes rendering slow, changing font color or font style is not that slow. We may also implement a way to write a custom clientside javascript renderer too. "Simon Benedicic" > Hi Farshad, > > > When I read complaints about UniDBGrid and conditional painting of grid > cells, I wonder if it would be possible to implement client only fixed > conditional painting javascript. Below is the code I am using in pure > ExtPascal project. Painting function is named ColorValue which is > containing some JavaScript and is later assigned to PROJECTED_BUDGET > COLUMN using RendererExtFunction. > > var > ColorValue : TExtFunction; > > // Function for conditional painting of column > ColorValue := JSFunction('V', 'if(V<400000){return " > style=''color:green''>" + V + "";}else ' + > 'if(V>400000){return "" + V + "";}' + > 'return V;'); > > // Grid columns > with ProjectBudgetGrid.AddTo(Items) do > begin > with TExtGridColumn.AddTo(Columns) do begin Id := 'PROJECTED_BUDGET'; > Width := 100; RendererExtFunction := ColorValue; end; > end; > > > Best Regards, > > Simon . Quote
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.