Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need some help with the algorithm
Message
 
 
À
07/10/2010 13:44:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01484275
Message ID:
01484377
Vues:
37
>>>Maybe I'm missing something but why do all this.
>>>If a node in the treeview changes just find the relevant record and update it accordingly ?
>>>
>>
>>The data updates are done, no problem. But what about re-sequencing? In other words, if you insert a node in the middle or remove a node in the middle, you need to re-sequence nodes in that particular branch.
>>
>>Now, the re-sequencing happens at the very end, when we're saving all the modifications made. The user could have done many modifications. So, by traversing the tree we're comparing the current order of each node with the SortOrder in the ItemTree table and adjust the Order if necessary.
>>
>>My problem is, that this process does extra changes - I want to do only the necessary (minimum changes).
>
>But if a node changes position it will only affect the sort order of its current/new siblings. Can't you just loop through the children of its parent node and reorder those (if it's moved to a different parent node you shouldn't have to worry about re-ordering its *ex*-siblings)
>
>FWIW, IIRC, the last time I did this (with approx 200-300 nodes in total) I simple read the whole table into the tree and wrote the entire thing out again afterwards. Overkill when there were only a few changes but made sense when the user was likely to make a lot of changes in one session but it avoided the whole problem of keeping the data records in sync with the tree.
>
BTW, one of the clients has a tree with more than 1K items. That's what caused the whole investigation process and desire to reduce the number of changes written.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform