2

我需要动态加载一个复选框并根据某个值设置其状态....

这是我到目前为止所做的......

(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 )
    )
  )

但由于某种原因,它们不起作用......可能是什么问题......有没有办法在这里设置复选框状态......?

谢谢..

4

1 回答 1

0

抱歉,我错过了一些东西..(((idv 1))在此处获取值的同时添加是必要的...我真的没有足够的时间去挖掘并找到甚至需要这样做的原因...因为library/clojure资源和教程太少了很难找到这些事情的理由......

(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 (= (((idv 1)result-rows :active)) 0)
       ((set-attr :checked  :val )%)%)
      (content (str ((idv 1) :gameprefix )))

    )
  )

)
于 2012-05-08T04:08:54.147 回答