@@ -177,4 +177,68 @@ def test_cf002_conditional_formatting_enterprise(dash_duo):
177177 until (
178178 lambda : "background-color: silver" in grid .get_row (6 ).get_attribute ("style" ),
179179 timeout = 3 ,
180+ )
181+
182+ def test_cf003_conditional_formatting (dash_duo ):
183+ app = Dash (__name__ )
184+
185+ columnDefs = [
186+ {
187+ "headerName" : "Make" ,
188+ "field" : "make" ,
189+ },
190+ {
191+ "headerName" : "Model" ,
192+ "field" : "model" ,
193+ },
194+ {"headerName" : "Price" , "field" : "price" },
195+ {"field" : "changes" },
196+ ]
197+
198+ rowData = [
199+ {"make" : "Toyota" , "model" : "Celica" , "price" : 35000 },
200+ {"make" : "Ford" , "model" : "Mondeo" , "price" : 32000 },
201+ {"make" : "Porsche" , "model" : "Boxster" , "price" : 72000 },
202+ ]
203+
204+ defaultColDef = {
205+ "valueSetter" : {"function" : "addEdits(params)" },
206+ "editable" : True ,
207+ }
208+
209+ getRowStyle = {
210+ "function" : 'testToyota(params)'
211+ }
212+
213+ app .layout = html .Div (
214+ [
215+ dcc .Markdown (
216+ "In this grid, the __Make__ column has a popup below the cell, the __Model__ has a popup above the cell, and the __Price__ has the default (in cell) editor."
217+ ),
218+ dag .AgGrid (
219+ columnDefs = columnDefs ,
220+ rowData = rowData ,
221+ defaultColDef = defaultColDef ,
222+ columnSize = "sizeToFit" ,
223+ getRowStyle = getRowStyle ,
224+ id = "grid" ,
225+ ),
226+ html .Button (id = "focus" ),
227+ ],
228+ style = {"margin" : 20 },
229+ )
230+
231+ dash_duo .start_server (app )
232+
233+ grid = utils .Grid (dash_duo , "grid" )
234+
235+ grid .wait_for_cell_text (0 , 0 , "Toyota" )
236+
237+ ### testing styles
238+ grid .get_cell (0 , 0 ).click ()
239+ until (lambda : "color: blue" in grid .get_row (0 ).get_attribute ("style" ), timeout = 3 )
240+ grid .get_cell (0 , 0 ).send_keys ("t" )
241+ grid .get_cell (0 , 1 ).click ()
242+ until (
243+ lambda : "color: blue" not in grid .get_row (0 ).get_attribute ("style" ), timeout = 3
180244 )
0 commit comments