Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3740

Upload - icons insteed of images

$
0
0

Hello Allan and everyoneelse,

I tried to upload PDF files with the upload many examples (https://editor.datatables.net/examples/advanced/upload-many.html) and insteed of showing the images (<img src=) I want to show icons with a link to the files.

But this doesn't work with FireFox:

                fields: [ {
                                label: "First name:",
                                name: "users.first_name"
                        }, {
                                label: "Last name:",
                                name: "users.last_name"
                        }, {
                                label: "Phone #:",
                                name: "users.phone"
                        }, {
                                label: "Site:",
                                name: "users.site",
                                type: "select",
                                placeholder: "Select a location"
                        }, {
                                 label: "Images:",
                                 name: "files[].id",
                                 type: "uploadMany",
                                 display: function ( fileId, counter ) {
                                         return '<a href="'+editor.file( 'files', fileId ).web_path+'"><img src="/intern/images/file_types/pdf.png"/></a>';
                                         // return '<img src="'+editor.file( 'files', fileId ).web_path+'"/>';
                                 },
                                 noFileText: 'No images'
                         }

And insteed of showing "1 image(s)" or "2 image(s)" I want to show an icon per file.

How can I add the url (e.g. web_path) into the link (<a href=)?

columns: [
                        { data: 'users.first_name' },
                        { data: 'users.last_name' },
                        { data: 'users.phone' },
                        { data: 'sites.name' },
                        {
                                 data: "files",
                                 render: function ( d ) {
                                         return d.length ?
                                                 '<a href=""><img src="/intern/images/file_types/pdf.png"/ width="32" height="32"></a>' :
                                                 'No image';

                                         return d.length ?
                                                 d.length+' image(s)' :
                                                 'No image';
                                 },
                                 title: "Image"
                         }
                ],

A complete example of my try can be found here -> http://wechselstube.host4free.de/editor/

Thanks for any help

pib


Viewing all articles
Browse latest Browse all 3740