Partly client-side, but primarily server side rendition of a sort of data tree-view implementation using PHP, MySQL, and some javascript/JQuery
| From: | Jacob Kruger | Date: | Tue, 07 Aug 2012 21:24:54 +0000 |
| Subject: | Partly client-side, but primarily server side rendition of a sort of data tree-view implementation using PHP, MySQL, and some javascript/JQuery | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-30945@lists.php.net to get a copy of this message | ||
If you want to check out what I think is now a working/operational version/instance of a sort of
encapsulated HTML list item data structure tree view, including editing/adding/deleting/display
state storing, etc., you can check out:
https://dl.dropbox.com/u/13327195/skillsTreeView.zip
Have made a bit of an effort to thus far compartmentalise/encapsulate it as well to make it sort of
reusable as well, FWIW, but, there might also be bits of unused/test code in it as well FWIW -
especially in the tree_view.php class implementation file, since that's sort of the include
file with most of the (server-side at least) data implementation functionality code in it, where
most of the interface code is in the javascript/JQuery code in index.php, and the actual data
link-up also happens in index.php, but that's honestly like the smallest chunk of code...:)
What did partly end up doing for sort of tree view data traversal is child object traversal, where
while it initiates traversing through objectified data structures from a higher up node, each
instance of an object will also continue the process down through it's own children, sort of
manually implemented, since the PHP array_walk_recursive() function didn't seem to want to
cooperate, when it came to passing varying bits of data through in steps.
And, this uses PHP, mysqli, and then some javascript/JQuery for client-side interface manipulation,
including one or two ajax posts initiated by JQuery, etc., but anyway - the one file you'll
really need to make changes to is the dbInc.php file, since it tells it where to locate the mysql
server, and what the name of the table is to look into for tree view data, and what field names to
make use of, etc.
What might also be of minor interest is that I am using JQuery code to occasionally interpret
current display state, and then store that in a session variable, using a sort of background ajax
post, to a separate file that only handles updating it, so that the idea is that when the main page
gets reloaded after doing something like having added a record to the tree view, it should, in
theory remember which nodes had been expanded/collapsed, etc. as well, and render that display state
again, on-the-fly, using the JQuery $(document).ready handler, after all parts of the document
object model are meant to have been instantiated.
Stay well
Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'