Guest Posted February 27, 2011 Share 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 . Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2011 Author Share 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 . 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