Edit does not work once a file is uploaded

Edit does not work once a file is uploaded

varsangvarsang Posts: 1Questions: 1Answers: 0
edited May 2016 in Editor

The edit button does not work once an image is uploaded. I played around and I figured that it has something to do with the display function. If I delete the following return from the display function, the edit button works.

return '<img src="'+table.file( 'files', file_id ).web_path+'"/>';

I have this as whole in the edit.

{
                        label: "Image:",
                        name: "image",
                        type: "upload",
                        display: function ( file_id ) {
                            return '<img src="'+table.file( 'files', file_id ).web_path+'"/>';
                        },
                        clearText: "Clear",
                        noImageText: 'No image'
                    }

I have the following for table display.

{
                        data: "image",
                        render: function ( file_id ) {
                    return file_id ?
                        '<img src="'+table.file( 'files', file_id ).web_path+'" class="img-responsive"/>' :
                        null;
                },

The table displays the image fine. Though in the editor, it doesn't display image after uploaded and once you exit out from the editor, the edit button doesn't work on ONLY image uploaded entries. For entries that do not have images, the edit button works.

Your suggestions and input is greatly appreciated.

Thanks

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Hi,

    Thanks for the code clips. I'm afraid I don't immediately see anything wrong with them. Could you give me a link to your page so I can debug it please. If it needs a login, feel free to PM me with the details by clicking my name above and then using the "Send message" button.

    Allan

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thanks for the link.

    When I upload a file I get the following error message shown on the console:

    samaiya_calendar.php:261 Uncaught ReferenceError: table is not defined

    Your table variable is in a different scope, hence that error.

    This error is also what is effecting the editing of rows with images.

    Apologies for the random wooden plane image - one of my test images :-). I would delete it, but can't edit that row!

    Allan

This discussion has been closed.