                :style {:borderTop (when (= i (:drop-index @state)) "1px solid gray")}}])])})
 
 
+(defn- filter-data [data columns filter-text]
+  (if (empty? filter-text)
+    data
+    (filter (fn [row]
+              (utils/matches-filter-text
+               (apply str (map-indexed
+                           (fn [i column]
+                             (if-let [f (:filter-by column)]
+                               (if (= f :none) "" (f (nth row i)))
+                               (str (nth row i))))
+                           columns))
+               filter-text))
+            data)))
+
+
 (react/defc Table
   {:get-default-props
    (fn []

        (when paginator-above [:div {:style {:paddingBottom (:paginator-space props)}} paginator])
        [:div {:style {:overflowX "auto"}}
         [:div {:style {:position "relative"
                        :minWidth (reduce + (map :width (filter :showing? (:ordered-columns @state))))
                        :cursor (when (:dragging? @state) "col-resize")}}
          (render-header state props)
          [Body (assoc props
                  :ref "body"
                  :columns (filter :showing? (:ordered-columns @state))
                  :initial-rows (react/call :get-sliced-data this true))]]]
        (when paginator-below [:div {:style {:paddingTop (:paginator-space props)}} paginator])]))
   :get-sliced-data
   (fn [{:keys [state refs]} & [initial-render?]]
     (let [[n c] (if initial-render?
                   [1 initial-rows-per-page]
                   (react/call :get-current-slice (@refs "paginator")))
           filtered-data (:filtered-data @state)
           sorted-data (if-let [keyfn (:key-fn @state)] (sort-by keyfn filtered-data) filtered-data)
           ordered-data (if (= :desc (:sort-order @state)) (reverse sorted-data) sorted-data)]
       (take c (drop (* (dec n) c) ordered-data))))
   :filter-data
   (fn [{:keys [state props]} & [filter-text]]
     (let [filtered-data
           (if (empty? filter-text)
             (:data props)
             (filter (fn [row]
                       (utils/matches-filter-text
                         (apply str (map-indexed
                                      (fn [i column]
                                        (if-let [f (:filter-by column)]
                                          (if (= f :none) "" (f (nth row i)))
                                          (str (nth row i))))
                                      (:columns props)))
                         filter-text))
               (:data props)))]
       (swap! state assoc :filtered-data filtered-data)))
   :handle-pagination-change
   (fn [{:keys [this refs]}]
     (react/call :set-rows (@refs "body") (react/call :get-sliced-data this)))
   :component-will-receive-props
   (fn [{:keys [state next-props refs]}]
     (swap! state assoc :filtered-data (:data next-props))
     (react/call :make-desynced (@refs "filterer")))
   :component-did-mount
   (fn [{:keys [this state]}]

   :get-initial-state
   (fn [{:keys [props]}]
     {:ordered-columns (vec (map-indexed
                             (fn [index col]
                               (assoc col
                                      :index index :showing? true
                                      :width (or (:starting-width col) 100)
                                      :starting-width (or (:starting-width col) 100)))
                             (:columns props)))
      :dragging? false})
   :render
   (fn [{:keys [this state props refs]}]
     (let [paginator-above (= :above (:paginator props))
           paginator-below (= :below (:paginator props))
           paginator [Paginator {:ref "paginator"
                                 :num-total-rows (count (:data props))
                                 :onChange #(react/call :set-body-rows this)}]]
       [:div {}
        (when (or (:filterable? props) (:reorderable-columns? props))
          [:div {:style {:padding "0 0 1em 1em"}}
           (when (:filterable? props)
             [:div {:style {:float "left" :marginRight "1em"}}
              [Filterer {:ref "filterer" :onFilter #(react/call :set-body-rows this)}]])
           (when (:reorderable-columns? props)
             [:div {:style {:float "left"}}
              [comps/Button {:icon :gear :title-text "Select Columns..." :ref "col-edit-button"
