DBTreeview, hiding or showing icons

Forum to discuss the new web client version of Servoy.

DBTreeview, hiding or showing icons

Postby huber » Thu Nov 03, 2022 9:55 am

I am using a DBTreeview Webcomponent [servoyextra-dbtreeview] for the application menus for NG1 and NG2. By default, there is an icon and a (menu) name shown.
There is an application wide menu to toggle between hiding and showing the above mentioned menu without or with icon.

This is done be following code:

Code: Select all
   if (scopes.domConfiguration.isIconHidden) {
      elements.domMenu.setImageURLDataprovider(controller.getDataSource(), 'no_icon_url');
      scopes.domConfiguration.isIconHidden = true;
   }
   else {
      elements.domMenu.setImageURLDataprovider(controller.getDataSource(), 'icon_url'); // Points to an image like 'absenzen.png' in Media node.
      scopes.domConfiguration.isIconHidden = false;
   }
   
   elements.domMenu.refresh();


In the menus table, where the DBTreeview is based on, there are 2 columns, one containing a transparent 1 x 16px transparent PNG image for the no_icon_url, the other one containing the icons. The icon images are stored in the Media node as PNG images.
The first level of the menus, like SEMESTERPLANUNG or PENSEN, have the 1 x 16px PNG assigned.

Hiding the icons works perfectly, showing it again shows the icons BUT for the first level menus it shows the default (yellow) icon instead of the 1 x 16px transparent icon. Refreshing the Browser corrects this, i. e. the transparent icon is shown and the menus look like in the first image.

See the images below.

My conclusion is, there is a refresh missing which I can not do programmatically, or at least I don't know how. Tried application.updateUI(), …

Any idea
You do not have the required permissions to view the files attached to this post.
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm

Re: DBTreeview, hiding or showing icons

Postby huber » Wed Nov 23, 2022 11:34 am

As a workaround, I can solve the unexpected appearance of the default yellow folder icons by executing the refresh() twice (see code in original post):

Code: Select all
   elements.domMenu.refresh();
   elements.domMenu.refresh(); // This is a workaround: After the first refresh the default yellow folder icon is shown on domains (first level nodes), this second refresh removes them.


There is obviously a difference by executing refresh() once or more times. It seems the refresh() method does not catch the first level image nodes correctly in the first run.

Regards
Robert Huber
7r AG, Switzerland
SAN Developer
http://www.seven-r.ch
User avatar
huber
 
Posts: 516
Joined: Mon May 14, 2012 11:31 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 6 guests

cron