cancel
Showing results for 
Search instead for 
Did you mean: 

How sort the members of a site on the preview dashlet dashboard of the site?

4535992
Star Collaborator
Star Collaborator

Our teams have developed two shares that work perfectly, the only difference is in the dashlet of the members of the single site are sorted by last name [first name] in one while in the other are sorted by name [last name]. Which property is such a difference?

Greetings.

1 ACCEPTED ANSWER

douglascrp
World-Class Innovator
World-Class Innovator

What you are saying like of makes no sense, as the code has an explicit sort by name in code, as you can see here and here

Are you talking about the OOTB colleagues dashlet?

View answer in original post

8 REPLIES 8

douglascrp
World-Class Innovator
World-Class Innovator

What you are saying like of makes no sense, as the code has an explicit sort by name in code, as you can see here and here

Are you talking about the OOTB colleagues dashlet?

ty for response douglas , your link are been very helpful and i think they can solved by problem and answer to my question, for your question, the dahslet i'm talking about is the standard documented here http://docs.alfresco.com/5.2/concepts/sites-dashlet-use.html.

let you know if i solved my problem with your advise.

Greetings

4535992
Star Collaborator
Star Collaborator

K the response of Douglas help me a lot, i'm not found on alfresco 4 the javascript colleagues.get.js , but i found  the script site-members.js to customize for sort by surname instead name:

 // Sort the member list by name
    items.sort(function (membership1, membership2)
    {
      var name1 = membership1.firstName + membership1.lastName,
         name2 = membership2.firstName + membership2.lastName;
      return (name1 > name2) ? 1 : (name1 < name2) ? -1 : 0;
    });

....................................................................

  if ((firstName !== undefined) || (lastName !== undefined))
         {
            name = firstName ? firstName + " " : "";
            name += lastName ? lastName : "";
         }

............................................................................
 
    // Sort the member list by surname

items.sort(function (membership1, membership2)
    {
      var name1 = membership1.lastName + membership1.firstName,
         name2 = membership2.lastName + membership2.firstName;
      
      return (name1 > name2) ? 1 : (name1 < name2) ? -1 : 0;
    });

.....................................................................

if ((firstName !== undefined) || (lastName !== undefined))
         {
            name = lastName ? lastName + " ": "";
            name += firstName ? firstName : "";        
         }

it's work when i go to the dashlet "All Members" of the site but it's not work for the "preview" in the site dashboard, there is some other javascript i need to modify? here i put a image of the problem:

They are order for name not surname. Someone can help me with that.

douglascrp
World-Class Innovator
World-Class Innovator

Hello.

Based on your text and the attached image, I could not understand what is and what is not working.

Can you please elaborate?

mehe
Elite Collaborator
Elite Collaborator

...I think Marco wants to sort the Users by lastName+firstName not by firstName+lastName which is the default sorting in the dashlet.

4535992
Star Collaborator
Star Collaborator

yes like martin said, sorry for the misunderstanding

douglascrp
World-Class Innovator
World-Class Innovator

Are you on Alfresco 4 yet?

The file colleagues.get.js, at least in Alfresco Share 5.2.e, is the file used for the dashlet Site Members:

   <shortname>Site Members</shortname>
   <description>Lists members in the collaboration site</description>

The file site-member.get.js is used by the webscript responsible to return data for the Site Members "page":

   <shortname>site-members</shortname>
   <description>Site Members component</description>

In this case, I don't know if the name of the file is right, as there are both site-members.js (the client side javascript file) and site-member.get.js (the webscript's controller).

So, there are different places to check/change, and I am not sure if you are talking about what I think you are.

Besides that, I still didn't get what is the preview you mentioned.

Sorry Douglas you were right from the start, for some reason my brain is trying to find the colleagues.get.js under alfresco webapp not the share, i have solved all. For anyone have the same issue you can find more detail into this question Sort site members by surname not name on site dashboard.

P.S i don't now how to call the scrool panel of the site-members show on the left side of the site dashboard , i think is acceptable call it "preview panel of the members of the site".

Greetings.