Upload field in Editor not returning 'files' object

Upload field in Editor not returning 'files' object

richardvkrichardvk Posts: 13Questions: 7Answers: 0

Hi,

I am using the Upload field type in Editor.

When displaying the Datatable with an image column, the "render function().....table.file( 'files', file_id ).web_path" section DOES return web_path properly as expected, and I see a 'files' array being passed back to the client side.

However the above 'table.file( 'files', file_id ).web_path' call does NOT return anything (its 'undefined' both when trying to render the image in the upload modal when the file has been selected, and also when redrawing the new row in the table).

The image does upload to disk successfully though, and the database entires are also good, and when i reload the Datatable manually then the image does appear.

I assume the 'table.files()' method reads the 'files' array that the php script returns in json? If thats the case, then the issue seems to be that this array is not always being returned, I only see it on a normal table load (ie when 'action' is emply, if 'action=upload' or 'action=create' then there is no 'files' array returned.

I am using all the latest code bases.

I did this for my own use case, and after failing to get it to work, i basically copied the version in the Editor docs, but get the same result.

Thanks,
Richard

Answers

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

    Hi Richard,

    Are you able to give me a link to the page you are working on so I can take a look and debug the issue? Failing that, are you able to show me the JSON response to the upload Ajax request and the Javascript used to initialise both the DataTable and Editor?

    Your understanding of the files() method sounds spot on. From your description it does sound like it should be working, so I'd need a bit more information I'm afraid.

    Thanks,
    Allan

  • richardvkrichardvk Posts: 13Questions: 7Answers: 0

    Thanks for the quick reply as always Allan.

    So i split off a section of dev code for you to access, and i downloaded all the packages from the download builder from scratch. I see v1.5.5 is out, i am still using 1.5.4 (sorry i thought it was the latest.)

    All seems to work fine in this edition, so i will update the libraries in my production site and see if that makes the difference. I will feed back if this resolves the issue or not :)

    -R

  • richardvkrichardvk Posts: 13Questions: 7Answers: 0

    Hi Allan,

    I tossed out all current Datatables and Editor libraries and replaced with 1.5.5, and this appears to have resolved the issue.

    Apologies for the false alarm and thanks again for your time. :)

    -R

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

    That's great to hear. Thanks for posting back with the update.

    Regards,
    Allan

This discussion has been closed.