Mmmm.... before you kill me, just want to let you know that, I usually hate the word "newbie", but I'm just that to ExtJS (not to javascript), second I RTFM (at least the API ref and some examples). I managed to build a layout, to add a tree to the left and to open a form in a dialog when you double click a tree node. So... I'm not the kind of guy willing to get my job done by others (well, in fact, ExtJS is somehow that, a HUGE part of the job getting done by the the creators :), for which I can only say THANKS)
So, here I shoot the issue. Say you want to associate custom data to a tree node. I guess it is a usual scenario. So you have some records, like a list of people, and only want to populate the "text" attribute of the tree node with, say, the name of each person; but you want to add other data (age, email, address, whatever...) to the tree node as hidden stuff that can be retrieved later. Sure, I know you could do the following: CodeProject: ASP.NET Discussion Boards. Free source code and :: 25 postsYou can use typed dataset for data transformation between layers. . a new topic i got another little (maybe stupid) question why is people adding http://www.codeproject.com/script/Forums/View.aspx?fid=12076&msg=1133757HOME |
var node = new Ext.tree.TreeNode({whatever_here});
node.myCustomBuggyDataToRetrieveLater = {howBad: 'are you', whenYou: 'write code'};
parentNodeGotSomewhereElse.appendChild(node);
But, I don't know if:
This will do the job and work just fine (as far as I tested it works) Invalid BTree, Invalid PEOF - Computing.Net:: I did read the suggestions above, but I have a terribly stupid questionor two ! HOW do I back up the hard drive? Do I need to back up everything I have on http://www.computing.net/answers/mac/invalid-btree-invalid-peof/3589.htmlHOME |
This is an "acceptable" (in the sense of best practices) way of dealing with the task
If someone could please help I might consider building a tutorial (or several ones) about this (or any other thing) when I get some level of command on the framework :).
Thanks in advance,
Rob
I'm creating a menu builder. Basically, the tree will map to a database structure afterwards.
This is how it works:
1 - A TreePanel to the left (the menu structure)
2 - A Panel with a Dataview to the right (default links to add to the menu)
3 - The end user can drag a "default link" to the tree, and can drag tree nodes or add folders (submenus) or blank menu itmes to the tree.
4 - When the user double clicks one tree node, he is presented with a form to set up the node (menu item = leaf, or sub menu = non-leaf). The form will not only contain the "display name"(=text for the node) but also the target url, an option to open the url in a new window or in the same window, maybe an option for a predefined style or image to add, etc.
I need a way to associate that propietary data to the node, so after the user is done with the "tree editing" he can hit a button and that structure can be sent to the server for further processing. I think I'll have no issues traversing the tree, I've done tree traversing one hundred times in the past. BUT, if those "fields" that get associated to each node can be easily managed using a Store (such as the inherent JSON/Ajax support), I'll do just that (I'm researching now). Enfranchised Mind ยป A WOW moment with continuations:: public class Ralist { /* A tree node */ private class Node { public final Object data; public final Node left; public final Node right; public Node(Object d http://enfranchisedmind.com/blog/2006/02/20/a-wow-moment-with-continuations/HOME | Creating Treenode after AJAX request - Ext JS Forums:: i'm pretty new to ext, so forgive me if i ask stupid questions. Yes i know. And i have no problems get an Async Treenode loading all its subnodes. http://extjs.com/forum/showthread.php?t=10241HOME |
The only drawback of this might be when the user drags a node (changes the display order, or moves the node to another branch). But, as long as I traverse the tree and lookup the data in the store, updating then the "order" (or use a custom attribute to hold the data on the nodes) I think I'll be fine.
Believe me, I searched for hours for something like this in the forums and found nothing like this. SURE, I must have missed something, or put the wrong keywords in the search field (I'm a native spanish speaker indeed).
If you have a better way, well... you are REALLY WELCOME! :)
Thanks in advance,
Hwo about http://extjs.com/forum/showthread.php?p=50302#post50302?
Guess what? found two other ways:
attributes : Object
The attributes supplied for the node. You can use this property to access any custom attributes you supplied.
... and a data lookup using a Store.
Anyway, hope it helps some dizzy coders that are trying to approach this framework, and hope I didn't get it wrong. I got too much used to prototype.
Btw, either the prototype adapter for Ext 2.0 is buggy or I missed something; I had to switch to ext-base.js, because it was throwing exceptions when closing an Ext.Window component. Maybe my code was buggy but switching to ext fixed it :) (It's ok, I only plan to use ExtJS for CMS stuff for now... so I won't miss prototype+script.aculo.us that much).
Thanks anyway.
Hwo about http://extjs.com/forum/showthread.php?p=50302#post50302?
Hey this is it!! I can't believe I missed that one, I actually saw the additional custom attribute in Firebug but was trying to do "node.customData" instead of "node.attributes.customData".
Thanks a lot XASD!! :)
Why not use dynamic nature of javascript if you can?How I understand you expect some kind of custom property for proprietary data storage,but it's useless from perspective of framework,so question why?
Regards.
Nobody understands...any help please?
50 points for someone willing to do this!!!!!!!!!!?
|