File Upload - issue with table.file() API

File Upload - issue with table.file() API

fabioberettafabioberetta Posts: 74Questions: 23Answers: 4
edited August 2015 in Free community support

Hello all,

I am trying to use the plugin for the file upload.

I get an error: TypeError: table.file is not a function.

this is caused by this line:

label: "Photo",
                    name: "child.photo",
                    type: "upload",
          display: function ( file_id ) {
                            return '<img src="'+table.file( 'file', file_id ).web_path+'"/>';
                    },

and

{ data: "photo", 
                        render: function ( file_id ) {
                            return file_id ?
                                    '<img src="'+table.file( 'file', file_id ).web_path+'"/>' :
                                    null;
                        },
                        defaultContent: "No image",
                        title: "Image"
                    },

I do not see what I am doing wrong. Can you help?

ty
f

This question has accepted answers - jump to:

Answers

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4

    I manage to fix this issue. I was just supplying the wrong field...

    Now... the plugin is filling the file table properly but no fiile is uploaded and the image_id is not fed to the final table...

    any hint?

    ty
    f

  • fabioberettafabioberetta Posts: 74Questions: 23Answers: 4
    edited August 2015 Answer ✓

    Finally I manage to work it out.

    It was a matter of using

    table = $('#children').DataTable({
    

    instead of dataTable...

  • allanallan Posts: 63,700Questions: 1Answers: 10,501 Site admin
    Answer ✓

    Hi,

    Good to hear you've got it sorted out now :-)

    Allan

This discussion has been closed.