drewness 26 Posted January 24, 2017 Report Share Posted January 24, 2017 (edited) Apologies if this has been asked before. I have a database that tracks folders, and items inside those folders. I'd like to present them in a Tree View in the UI HTML Panel, but I can't seem to figure out a good way to do it. Ideally it would look like Folder #1 - Item #1 - Item #2 - Item #3Folder #2 - Item #4 - Item #5 etc. I know I could use some kind of HTML/CSS/Javascript to get the tree view functionality working, but I can't figure out how to best populate the tree, and equally important: how to call a ubot function when an item (not folder) is clicked. Is the only way to loop through the database, pull the folder name, build an unordered list and populate the list for each item inside the folder in a string builder, then render the final result in the UI? That seems sloppy, hoping someone might know of a better way. And even if that is the best way, how would you recommend setting a trigger on each tree item to fire on click, and report back to ubot the value clicked? Thanks for your time, hope that makes sense! Edited January 24, 2017 by drewness Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 25, 2017 Report Share Posted January 25, 2017 I can show you how to pass parameters from your UI HTML Panel (or Load HTML), you could pass the items that way. But for a treeview you would have to make a command that basically builds the HTML for you. ui html panel("<html> <body> <button onclick=\"ubot.runScript(\'MyMethod("hello")\');\">Click</button> </body> </html>","") define MyMethod(#msg) { alert(#msg) } 1 Quote Link to post Share on other sites
drewness 26 Posted January 26, 2017 Author Report Share Posted January 26, 2017 Great, thank you for the info, much appreciated! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.