Click here to Skip to main content
15,905,232 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i'm using following j query to Reorder tree view Nodes
now i want to save these nodes in File or on Server Side
how i can do this....
HTML
<div id="tree">
   </div>


C#
<script type="text/javascript"><!--
        $(function () {
         
            $("#tree").dynatree({
                initAjax: {
                    url: "sample-data3.json"
                },
                onLazyRead: function (node) {
         
                            });
                },
                dnd: {
                    onDragStart: function (node) {
                        logMsg("tree.onDragStart(%o)", node);
                        return true;
                    },
                    onDragStop: function (node) {

                        logMsg("tree.onDragStop(%o)", node);
                    },
                    autoExpandMS: 1000,
                    preventVoidMoves: true, 
                    onDragEnter: function (node, sourceNode) {
                      

                        logMsg("tree.onDragEnter(%o, %o)", node, sourceNode);
                        return true;
                    },
                    onDragOver: function (node, sourceNode, hitMode) {
                       
                        logMsg("tree.onDragOver(%o, %o, %o)", node, sourceNode, hitMode);
                       
                        if (node.isDescendantOf(sourceNode) && sourceNode.parent.data.title != node.parent.data.title) {
                            return false;
                        }
                       
                        if (!node.data.isFolder && hitMode === "over") {
                            return "after";
                        }
                    },
                    onDrop: function (node, sourceNode, hitMode, ui, draggable) {
                      
                        if (node.parent.data.title != sourceNode.parent.data.title)
                            return;
                        if (hitMode == 'over')
                            hitMode = 'before';

                        logMsg("tree.onDrop(%o, %o, %s)", node, sourceNode, hitMode);

                        sourceNode.move(node, hitMode);
                       
                    },
                    onDragLeave: function (node, sourceNode) {
                         logMsg("tree.onDragLeave(%o, %o)", node, sourceNode);
                    }
                }
            });
        }
        );
--></script>
Posted
Updated 12-Feb-14 1:17am
v6
Comments
Killzone DeathMan 12-Feb-14 6:15am    
Whats the "jsonLocs" content?
kedar001 12-Feb-14 6:22am    
null
kedar001 12-Feb-14 6:37am    
i have updated my Question

1 solution

You can not save data from JavaScript - inside a browser - to any storage!
For security reasons you web page is isolated from the client's machine (sandbox) and can not access it's resources, like disk...
 
Share this answer
 
Comments
kedar001 12-Feb-14 7:02am    
thanks for your replay..
i have updated my Question. i need to get modified Tree view nodes. plz ...
Kornfeld Eliyahu Peter 12-Feb-14 7:08am    
You wan't to save the data on the server?
So no jQuery is relevant! What you server side platform is?
kedar001 12-Feb-14 7:14am    
C#
Kornfeld Eliyahu Peter 12-Feb-14 7:18am    
Do these:
1. Make you 'tree' visible to server side by runat="server"
2. Add Json.Net (http://james.newtonking.com/json) to your project
3. Use Json.net to create json string from 'tree'
4. Use System.IO to save
kedar001 12-Feb-14 7:35am    
thanks ...
but i'm getting blank Tree. "(\r\n )" only

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900