Right now SelectOption is sorting my selection of documents based on the TimeStamp of the document that has been uploaded, but I want to be able to have my list to be same order as what I select and not based on TimeStamp Here Ill try to explain this better.
So I am showing bunch of documents to the user. User will pick the documents in any order they would like. I need to get the same arbitrary order of the pick list that I have in docNames and pass it to BLST list . currently the system is sorting the BLST List based on TimeStamp, but I need it bast on docNames or (User) entry order not timestamp
public List<String> selectedDocuments {get; set;}
for (Document d :documents = [SELECT Id, Name , Body
from Document Where (FolderId =: UserInfo.getUserId() OR FolderId =: '00lG0000001bBXb') AND ContentType = 'application/pdf']){
docNames.add(new SelectOption(d.Id,d.Name));
}
for (Document d :documents = [SELECT Id, Name , Body
from Document Where Id in:selectedDocuments ]){
BLST.add(Docments)
}
Component
<apex:inputTextarea id="newDesc" value="{!Name}"/><p/>
<apex:selectList value= "{!selectedDocuments}" multiselect="true">
<apex:selectOptions value = "{!docNames}"/>
</apex:selectList>
<apex:commandButton action="{!Save}" value="Click" reRender="frm"/>