我正在尝试实现一种行样式,以便如果重要列缺少值,则该值应为红色(如警报)。我有以下逻辑:
(defn missing-requirements? [params]
(not (every? (js->clj (.-data params)) @state/important-tags)))
这是正在渲染的主要功能
(def ag-adapter (r/adapt-react-class (.-AgGridReact js/agGridReact)))
(defn home-page []
[:div [:h2 "Ekspono tag-model"]
[:p "My portfolio / Top Index " [:a {:style {:background-color "#C0C0C0" :float "right" :color "black"}
:href "https://www.google.com" :target "_blank"} "Show problems"]]
[:div {:className "ag-theme-balham" :style {:height 200 :width 700 :color "purple"}}
[ag-adapter {:modules "AllCommunityModules"
:columnDefs @state/cols
:rowData @state/rows
:defaultColDef {:sortable true
:filter "agTextColumnFilter"
:floatingfilter true
:resizable true
:flex 1
:width deafult-col-w}
:getRowStyle (fn [params] (if (error/missing-requirements? params) {:background-color "Green"}))
:sidebars "filters"
:onGridReady (fn [params]
(:gridApi (.-api params))
(:gridColumnApi (.-columnApi params)))}]]])
只是:rowStyle {:background-color“ red”}工作正常。有人知道什么地方可能出问题吗?我具有ag-grid-react版本21.0.1-1作为依赖项。
通过添加如下所示的#js来解决
:getRowStyle (fn [params] (if (error/missing-requirements? params) #js {:background-color "Green"}))