Datatable with uploadMany : uncaught exception: Unknown file table name:
Datatable with uploadMany : uncaught exception: Unknown file table name:
sarath_surisetty
Posts: 54Questions: 13Answers: 0
Hey allan
im trying to implement uploadMany,
->implemented add successfully with ajax.,but got issue with edit ,please see the below error
uncaught exception: Unknown file table name: propertyImages
code:
{
label: "Images:",
name: "propertyImages[].imageId",
type: "uploadMany",
ajax: 'propertyImage/add',
display: function(imageId, counter) {
return '<img src="' + propertyEditor.file('propertyImages', imageId).imagePath + '"/>';
},
noFileText: 'No images'
}
json data
for the table:
{
"draw": 1,
"recordsTotal": 3,
"recordsFiltered": 3,
"data": [{
"propertyId": 7,
"propertyFacing": "EAST",
"active": "Active",
"propertyImages": [{
"imageId": 1,
"imageName": "NO_IMAGE",
"imageType": "jpeg",
"imageSize": 0,
"imagePat": "/propertyImages/NO_IMAGE"
}]
}],
This discussion has been closed.
Answers
It means that on the server-side there is no
Upload
configured for the field calledpropertyImages[].imageId
.Can you show me your server-side code?
Thanks,
Allan
hi allan
thanks for quick response, server-side is coded in java sprinboot..
Service:
Ah - I see the issue now - thanks. It isn't actually a problem with the controller (well, it might be, but...), rather this call:
is resulting in the error because there is no information about files from
propertyImages
. When the JSON is loaded for the DataTable, it should have afiles
property for thefiles()
method to work - documentation for that is here.What is the JSON that is being loaded for your table at the moment?
Allan
hi allan json data is :
Yes, that would do it. There is no
files
property so thefile()
method won't be able to find anything.What do you want to show in the cell?
Allan
want to show the images for editing,would like to delete or add more images if required.
seen similar issue over here https://datatables.net/forums/discussion/41397/uploadmany-editor-files-not-populating-on-standalone-editor but not able to understand where to keep the code for populating the table with script $.extend( Editor.files[ table ], files );
when i try below code no luck
i changed the json to below but still geting error : >! uncaught exception: Unknown file table name: files
I'd expect something more like this:
I.e. the
files
property is shared for all rows and an id can be looked up if needed.Allan
hi allan
thanks for the solutions, but can u suggest with which even i can modify the json data before binding to the edtior/table.
hey allan i figured it out
it should be at aja-> "dataSrc": function ( d ) { ...
will post back once tested..
hi allan i had manipulated data like below and now the table is not getting populated with data and im trying to implement uploadMany from long time not able to complete task, please save me .thanks in advance.
Could you give me a link to your page so I can take a look please? You sholdn't need to use
ajax.dataSrc
at all with that JSON.Thanks,
Allan
hi allan
this is hosted locallay, i can send u the js and html code and ajax response.
->as i cannot manipulate data on server side, im trying to manipulate data to expected fomat suggested by you on client side.is there any way to manipulate data(including files) when data returned from ajax before biding to datatable.