Hi all,

I have a menu tree with three levels, MENU_TREE_ROOT, MENU_TREE_LEVEL1, MENU_TREE_LEVEL2. I am using api_datasource.setdefaultquery to filter the query based on user role in my postinitilization procedure. My tree definition datasource is the MENU_TREE_ROOT menu as under:

tree name="TREE1" displayColumn="NAME" nodeKeyColumn="ID" dataSource="TREE_ROOT" nodeStateColumn="NODESTATE">

The problem is my setdefaultquery command does not work for the MENU_TREE_ROOT level. But works with the other two levels. However, if I put the same filtering in the datasource definition itself directly at design time it works.

Am I doing some mistakes somewhere? Kindly help.

George.

asked 29 Mar '13, 09:24

George's gravatar image

George
1111226
accept rate: 0%


Hi George,

I guess you are calling your postinitilization procedure in the postInitialize event of your panel containing the tree. The postInitialize event of a panel fires just after the initialization of all the objects existing in this panel is completed, including the datasource of tree (TREE_ROOT).

If the queryOnInitialize attribute of the TREE_ROOT datasource is set to Y, this datasource will be queried when it's initialized, which means that it will be queried before the postInitialize event of the panel, therefore also before your api_datasource.setdefaultquery API call takes effect.

To achieve your request, you can set queryOnInitialize attribute of the TREE_ROOT datasource to N and then execute this datasource in your postinitilization procedure using api_datasource.executeQuery API, just after the api_datasource.setdefaultquery API call.

You can set the queryOnInitialize attribute of a datasource through the "Query On Initialize" checkBox existing in the datasource edit dialog.

Hope this helps,
Ibrahim

link

answered 29 Mar '13, 10:02

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Hi Ibrahim,

Following your advice I removed "Query On Initialize" checkBox for all the three queries and added api_datasource.executeQuery. Result: The root which had the original problem started to work correctly,but lost bold fontstyle. At the same time the other two queries stopped functioning. Therefor, I re-check marked all the three queries for "Query On Initialize". Then I added the api_datasource.executeQuery for the first query only. And everything works fine now. The only problem is I lost my BOLD fontstyle for the ROOT query while the other two queries are BOLD and working.

George

(29 Mar '13, 15:30) George

Hi George,

You have to execute each datasource that is set as "Query On Initialize" = "N" using api_datasource.executeQuery API. Since you are currently executing only the root, it's normal that the other two queries stop functioning. In your case, you can still uncheck the "Query On Initialize" checkBox for the root and keep checked for the other two queries.

I guess you are using fontStyleColumn attribute of the tree to set the bold fontstyle, I'm able to reproduce the problem you have described using the fontStyleColumn attribute. If it's so, this is a bug, I registered it to our issue management system, thanks for your feedback.

Regards,
Ibrahim

(30 Mar '13, 08:46) Ibrahim Sand... ♦♦

Hi George,

During my tests, I noticed that you can also use api_treenode.populatechildren API instead of the api_treenode.executeQuery API to execute the root datasource and populate nodes. In fact, since the datasource is bound to a tree component, it would be even better to use the api_treenode.populatechildren API instead of api_treenode.executeQuery API. The use of the api_treenode.populatechildren API will also fix your problem with the fontstyle. You may populate root nodes as:

..
api_datasource.setdefaultquery(...);
api_treenode.populatechildren('panelName.TREE1', '');
..

Hope this helps,
Ibrahim

link

answered 30 Mar '13, 09:03

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Hi Ibarahim,

My tree was perfectly working after testing with the changes I mentioned above except for the fontstyle. I was using the command (select ..., 'Bold' as fontStyle from ..) as part of the query itself.

Now, I changed populate method to api_treenode.populatechildren('panelName.TREE1', '') as suggested and fontstyle is working fine. Now, there is no problem with my trees.

Thank you very much.

George.

(30 Mar '13, 09:50) George
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×11
×1

Asked: 29 Mar '13, 09:24

Seen: 1,240 times

Last updated: 30 Mar '13, 09:50


© Copyright Gerger 2017