[SOLVED]Auto expand jsTree

English! place to talk about development, programming and coding
Post Reply
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

[SOLVED]Auto expand jsTree

Post by Eggllo »

Hi everyone,

Is there a way to automatically expand the jsTree used for subQueue selection? Ideally for both when a customer is selecting a queue and when an agent want's to move or change a ticket's queue.

I wasn't able to find it in any of the places I looked...

Thanks for any help in advance.
Last edited by Eggllo on 18 Jul 2016, 19:30, edited 1 time in total.
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

Re: Auto expand jsTree

Post by Eggllo »

Update:

Not exactly what I was looking for, but in the settings for the customer and agent front-end there is an option to use 'modern forms' or use standard forms. Opting to not use modern forms seems to have automatically expanded the subQueues when selecting a queue or moving a ticket. This is what I wanted, but the only downside is you have to deal with the fact that every other form is also changed in the same way. Not too bad of a trade off IMO, though I'm sure with some custom development there might be a better solution.

Edit: Changing the Ticket::Frontend::ListType to list view will also show all of the queues and sub queues, but sub queues will be shown as parentQueue::Subqueue, and will not be indented.
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Auto expand jsTree

Post by reneeb »

Untested: Just add in https://github.com/OTRS/otrs/blob/maste ... on.js#L285 this code

Code: Select all

  .on('ready.jstree', function() {
    $TreeObj.jstree('open_all');
  })
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

Re: Auto expand jsTree

Post by Eggllo »

Hi reneeb,

Unfortunately, this doesn't seem to have done anything. I had also tried something similar when I was first trying to figure it out and that didn't work either. Am I just doing something wrong when changing the code? Not the best with perl or js but I would like to think I'm able to copy and paste properly. :D

I've also tried binding the action to loaded.jstree, but that didn't seem to do anything either
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
reneeb
Znuny guru
Posts: 5018
Joined: 13 Mar 2011, 09:54
Znuny Version: 6.0.x
Real Name: Renée Bäcker
Company: Perl-Services.de
Contact:

Re: Auto expand jsTree

Post by reneeb »

This is tested with OTRS 5.0.8 and the Queue dropdown:

https://gist.github.com/anonymous/f2ac0 ... f12184d451
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Eggllo
Znuny newbie
Posts: 79
Joined: 09 Jun 2016, 14:27
Znuny Version: 5.0.10

Re: Auto expand jsTree

Post by Eggllo »

Got it to work, thanks so much for your help.

I was editing Core.UI.TreeSelection.js, foolish me never had the thought to go to Core.UI.InputFields.js. Adding in the code you suggested at line 1385 seems to have done the trick.

Thanks again.
OTRS v5.0.10 with ITSM extension.
MySQL database
Ubuntu 16.04 LTS
Post Reply