开发者

struts 2 <if>tag for selecting checkbox

开发者 https://www.devze.com 2023-04-13 07:23 出处:网络
I want to implement some functionality--there are multiple rows with a checkbox at the starting in a jsp file in struts2.1 framework. If the checkbox is checked then at the same instant the color of t

I want to implement some functionality--there are multiple rows with a checkbox at the starting in a jsp file in struts2.1 framework. If the checkbox is checked then at the same instant the color of that row should c开发者_如何转开发hange, like it is selected. How should I implement this?


I recommend the jQuery plugin – tableRowCheckboxToggle (demo)


I agree with lschin; use a canned solution.

That said, you could also do it "manually" using jQuery or similar. Attach an onclick handler to each checkbox that sets a CSS style on its containing row.

Simplistically, use the checkbox's onclick attribute to provide a click handler and an ID that can be used to find the containing row.

Less obtrusively (and arguably better all around), find the row containing the checkbox by walking up the DOM (in jQuery, something like inside the attached click handler: $(this).parents("tr")[0]) and don't worry about throwing around a lot of IDs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号