DBTreeView

Questions and answers on developing, deploying and using plugins and JavaBeans

DBTreeView

Postby bobcart » Tue Feb 22, 2005 10:31 pm

I'm having trouble with DBTreeView. I can get it to work like the Book STudie example, but I can't get it to do exactly what I want. I am hopeful that the two set relation functions might help. However, I can't figure out what they do and why there are two of them, i.e. setNRelationName and setMRelationName. Any hints much appreciated.
bobcart
 
Posts: 214
Joined: Fri Nov 21, 2003 8:01 pm
Location: Melbourne (AUS)

Postby Cain » Wed Feb 23, 2005 4:26 pm

I have to admit, I copied the examples and only changed what I needed.

The set relation functions tell the bean what the relationship is between a node and its children. I only use the N-relation function, and it works fine.

I would assume that the reason that there are two is that the relationship could be described in one of two ways: from parent to child or child to parent. The N-relation is parent to child.

I'm not 100% on this, but using just the N-relation function, I have it working.
Cain
 

dbtreeview

Postby friedrich toussaint » Wed Feb 23, 2005 7:10 pm

dear bob,

here is a description for you:

you need four scripts to init DBTreeView
1. a global script that only calls a form script
2. the form script
3. a refresh script
4. an init script
5. a global called globals.didTreeViewInit
6. a table within not less than three fields:
id
parentid
name
7. a self relation (parentid_to_id)

-----------------
1.:
it is called from the bean when something changed
arg01 = given argument from the bean (e.g.: the selected id)

//script beginn
arg01 = arguments[0]; // get the argument
forms.kategorie_tree.id_selected(arg01); // call the form script
//script end
------------------
2.:
it is called from the global script
arg01 = the given argument from the global script (e.g.: the selected id)

//script beginn
// get the argument
var selected_id = arguments[0];

// set some own variables
globals.id_to_show = selected_id;
globals.kategorieordner = forms.help_controller.help_benutzer_to_kategorie.sortfield;

// search the id
controller.find();
kategorieid = selected_id;
var recordcount = controller.search();

// search in own forms in Tabs
forms.help_controller.suchen();
//script end

--------------
3.:
it refreshes the bean on init with the field to show in it

//script beginn
// search data with no parent
controller.find();
parentid = 0;
controller.search();
// set the field what is shown in the bean
elements.tree.setRoots(foundset, 'name');
//script end

-------------
4.:
it is called in the form with "onLoad" or "onShow"

//script begin
if (globals.didTreeViewInit == 0)
{
//sets the relation for the tree
elements.tree.setNRelationName('kategorie_to_kategorie');

//sets the field whereto whitch field is to write
elements.tree.setCallBackInfo(globals.id_selected, 'kategorieid');

// calls the init refresh
refresh_tree();

//sets that init is done
globals.didTreeViewInit = 1

// calls an own script
forms.helps_table.alle_suchen();
}
//script end

--------------------------------


Yours sincerely
friedrich toussaint[/list][/code]
friedrich toussaint
 
Posts: 31
Joined: Tue Aug 03, 2004 1:32 pm
Location: Linz, Austria

Postby bobcart » Wed Feb 23, 2005 10:12 pm

Thanks guys. I should have been clearer in my post. I do have it working fine with a 1-N relation using the set N relation. However, I want to tune the way my DBTreeview functions and want to know how all the controls work. I'm hoping using the M relation can help with my needs.

When I tried the two different set M Relation, I get unexpected results, i.e. the M one doesn't work with a child-parent N-1 relation. It just says, "Loading" when you open a node.

Has anyone figured out how to use the M relation?
bobcart
 
Posts: 214
Joined: Fri Nov 21, 2003 8:01 pm
Location: Melbourne (AUS)


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 31 guests

cron