2
我需要動態地加載一個複選框,並設置基於某個值的狀態....的Clojure:動態加載的形式在enlive-HTML
這是我迄今所做的......
(defsnippet customer-config-setup html-customer-configuration [:div#div_game_setup_container ]
[result-rows]
[:div#div_gameprefix]
(clone-for [idv (map vector (iterate inc 0) result-rows)]
[:button#btn_gameprefix ]
(do->
#(if (= (result-rows :active) 0)
((set-attr :checked :val)%)%)
(content (str ((idv 1) :gameprefix)))
)
)
)
也
(defsnippet customer-config-approval html-customer-configuration [:div#div_auto_approval ]
[result-rows]
[:tr#tr_auto_approval]
(clone-for [idv (map vector (iterate inc 0) result-rows)]
[:td#td_auto_approvaltext ] (content (str ((idv 1) :settings_caption)))
[:td#td_auto_checkbox ] (set-attr :checked :val)
)
)
但出於某種原因,他們沒有工作...可能是什麼問題....是有沒有辦法在這裏設置複選框狀態.....?
謝謝。
我聽不太懂的背景:在第一個片段,有什麼結果,行,你想用clone-for等來完成什麼?(爲什麼你編號行而不使用數據? ) – cgrand