[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4284: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4286: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4287: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4288: Cannot modify header information - headers already sent by (output started at /includes/functions.php:3493)
www.dhtmlgoodies.com • View topic - Reloading nodes with AJAX and showhidenode
Advertisement

Reloading nodes with AJAX and showhidenode

Moderators: Calcifer, slothy

Reloading nodes with AJAX and showhidenode

Postby DirtyHarry » Sat Sep 02, 2006 10:18 pm

Hello!

I am using the static folder list script, with AJAX support activated. I load nodes from a MySql database - I would like to know if there is a way to really reload nodes when I open/close a folder. For example, if the user opens the webpage with the tree, and meanwhile the database is updated and one of the folders of the tree is renamed, I would like to let the user update his tree by closing/reopening the folder containing the updated folders/files.

Is it possible?

Thanks again!
DirtyHarry
 
Posts: 4
Joined: Thu Jul 06, 2006 11:17 pm

Postby slothy » Wed Sep 06, 2006 11:23 pm

Hi DirtyHarry

(see bottom for better solution)

i know this may sound silly, but have you thought about just calling the same function that was called on the onload relevant to the drawing of the tree?

Just delete descendants of the top treeNode and redraw the tree with a fresh call.

This would be wasteful but I cant imagine having to call it many times per page visit....would be a bit consuming of course if you had very large trees...

Alex

NB. An afterthought: It may be a good idea to have a database table, say treestates, that contains pertinent info of trees: treeName(this could be Primary Index but could have extra treeID field if you fussy) and lastupdated fields .
So if you have 5 trees say in the database each will have a correspnding row in treestates.
So everytime you update a tree (as you have called the functions to update, add or delete nodes) you simultaneously update the lastupdated field of corresponding tree entry in treestates with the current timestamp.

Now when user comes back to page it polls the treestates table (very simple AJAX call) . And if the lastupdated field is greater than a lasttested [that contains a timestamp that it last invoked the call) , say, variable THEN you KNOW it has changed and go through the call of the function to reload.....

This is less stressful on the server..only one simple call

Someting like "SELECT IF (lastupdated > {$_GET['lastchecked']},1,0) FROM treestates WHERE tree.id = {$_GET['treeid']} "

if it returns 1 you have to redraw else there is no change
slothy
Moderator
 
Posts: 58
Joined: Fri Aug 25, 2006 1:42 pm

Postby Batalf » Wed Sep 06, 2006 11:50 pm

Batalf
Site Admin
 
Posts: 2160
Joined: Sat Oct 22, 2005 9:38 pm


Return to Folder tree questions

Who is online

Users browsing this forum: No registered users and 2 guests

cron