Ag-grid getRowStyle 无法正常工作
Ag-grid getRowStyle doesn't work properly
我正在尝试实现一种行样式,如果重要的列缺少值,那么它应该是红色的(如警报)。我有以下逻辑:
(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"}))
我正在尝试实现一种行样式,如果重要的列缺少值,那么它应该是红色的(如警报)。我有以下逻辑:
(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"}))