cancel
Showing results for 
Search instead for 
Did you mean: 

Template List order

crono40
Champ on-the-rise
Champ on-the-rise
Hi all,

I'm using Alfresco Share 4.2.f

I have a problem. I upload few files in the folder Repository/Data Dictionnary/Node Model.

So when i want to create a file thanks to a template, i have the list in the menu containing all my templates. The problem is that the list is not sorted : not by name, by title, by description or by nodeRef.

We are using a project method for templates. For examples, i want first in the list the specifications, after the quality document and to finish the test document.

Is there a way to do this ? When i add each time a document, the list mixes.

Waiting for your Help. Thanks a lot.

Florian

PS: Sorry for my english Smiley Happy

2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
You need to lookinto toolbar.js file under share/components/documentlibrary inside that this drop down is generated.

Thanks a lot.

I prefixed the name file with the number of method project like "01-FileName".

I sorted the array by name and when i create a model. I execute a rule deleting the first part of the Name.

That the code updated :
<javascript>
fn: function(response, menu)
                  {
                     var nodes = response.json.data,
                        menuItems = [],
                        name;
               //Rajout pour trier la liste des noeuds en fonction du nom.
               nodes.sort(function(a,b){
                  var nameA = a.name.toLowerCase(), nameB=b.name.toLowerCase();
                  if (nameA < nameB) //sort string ascending
                    return -1;
                  if (nameA > nameB)
                    return 1;
                   return 0; //default return value (no sorting)
               });
                     for (var i = 0, il = nodes.length; i < il; i++)
                     {
                        node = nodes;
                        name = $html(node.name);
                        if (node.title && node.title !== node.name && this.options.useTitle)
                        {
                           name += '<span class="title">(' + $html(node.title) + ')</span>';
                        }
                        menuItems.push(
                        {
                           text: '<span title="' + $html(node.description) + '">' + name +'</span>',
                           value: node
                        });
                     }
                     if (menuItems.length == 0)
                     {
                        menuItems.push(this.msg("label.empty"));
                     }
                     templateNodesMenu.clearContent();
                     templateNodesMenu.addItems(menuItems);
                     templateNodesMenu.render();
                  },
</javascript>