jQuery UI Widgets › Forums › Navigation › Tree › How to put checkboxes on some but not all
Tagged: checkboxes, source, Tree
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 12 years, 5 months ago.
-
Author
-
I now this is my third post in about 3 hours, but — I figured I’d keep going while I’m on a roll:
Is there a way, using the source option and with checkboxes set to true, to only have checkboxes on certain elements? i.e. If I have three tiers, only have checkboxes on items in the third tier but not on the parent containers of those items?
Or should I do this the other way around and set checkboxes option to false, adding the checkboxes to each item that I want?
Thanks,
MikeHi Mike,
There isn’t such a built-in feature, but you can add basic Input tags to the third-level tree items:
For example:
<div id='jqxTree'> <ul> <li>Home</li> <li>Solutions <ul> <li>Education</li> <li>Financial services</li> <li>Government</li> <li>Manufacturing</li> <li>Solutions <ul> <li><input type="checkbox" />Photo and video</li> <li><input type="checkbox" />Mobile</li> <li><input type="checkbox" />Rich Internet applications</li> <li><input type="checkbox" />Technical communication</li> <li><input type="checkbox" />Training and eLearning</li> <li><input type="checkbox" />Web conferencing</li> </ul> </li> <li>All industries and solutions</li> </ul> </li> </ul></div>
Or
var source = [{ label: "Mail", expanded: true, items: [ { label: "Calendar" }, { label: "Contacts", selected: true }]},{ label: "Inbox", expanded: true, items: [ { label: "Admin" }, { label: "Corporate" }, { label: "Finance" }, { label: "Other", items: [ { label: "<input type='checkbox'/>Third Level Item 1" }, { label: "<input type='checkbox'/>Third Level Item 2" }, { label: "<input type='checkbox'/>Third Level Item 3" } ] },]},{ label: "Deleted Items" },{ label: "Notes" },{ label: "Settings" },{ label: "Favorites" },];
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.