Autor Thema: AttachmentName mit Javascript  (Gelesen 6526 mal)

Offline snowfish26

  • Frischling
  • *
  • Beiträge: 21
  • Geschlecht: Weiblich
AttachmentName mit Javascript
« am: 05.08.14 - 14:00:35 »
Hallo Zusammen

Ich versuche gerade eine Dojo Image Gallery in meine DB einzubinden.

Leider funktioniert folgende Code Zeile überhaupt nicht

var fileNames = "#{javascript:@AttachmentNames();}";

Hier bekomme ich überhaupt nichts. Hat jemand den ultimativen Tipp.

Nachstehend den ganzen Code

<xp:eventHandler event="onClientLoad" submit="false">
        <xp:this.script><![CDATA[// Build the data store of image urls and make it available with a client-side JS variable
// Build each URL in this format: DB.nsf.nsf/0/docUNID/$File/attachmentname
var fileNames = "#{javascript:@AttachmentNames();}";

// It comes back as a concatenated string, surrounded by square brackets, to parse into an array
fileNames = fileNames.substring(1, fileNames.length-1).split(', ');

var docID = "#{javascript:param.documentId;}";

var itemNameMap = {
  imageThumbAttr: "thumb",
  imageLargeAttr: "large"
};
 
// Build an array of image items for the thumbnail's data store
var imageData = {};
imageData.items = [];
for (var i=0; i< fileNames.length; i++) {
    var newItem = {};
    newItem.thumb = './' + docID + '/$File/' + fileNames;
    newItem.large = './' + docID + '/$File/' + fileNames;
    newItem.title = 'Image: ' + fileNames;
 
    imageData.items.push(newItem);
}
 
// Initialize the data store
var imageStore = new dojo.data.ItemFileReadStore({
    identifier: 'title',
    label: 'Images',
    data: imageData
});
 
var request= {};
 
// Initialize the Thumbnail Picker
dijit.byId('galleryDisplay').setDataStore(imageStore, request, itemNameMap);
 
dijit.byId('#{id:galleryDisplay}').setDataStore(imageStore, request, itemNameMap);
    ]]></xp:this.script>
    </xp:eventHandler>

Danke für Eure Hilfe.

Stephanie Widmer

Matze84

  • Gast
Re: AttachmentName mit Javascript
« Antwort #1 am: 07.10.14 - 08:44:28 »
Zeigt deine XPage ein geöffnetes NotesDocument? bzw. wurde das Document bereits gespeichert?

Ich hab das Ganze mal mit einer Test- XPage nachgebaut und ich bekomme zuverlässig im onClientLoad Event per CSJS
den Namen der vorhandenen Attachments.

Gruß

Matthias

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz