datatable-with-uploadmany-uncaught-exception-unknown-file-table-name
datatable-with-uploadmany-uncaught-exception-unknown-file-table-name
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 question has accepted answers - jump to:
Answers
That's the same error and issue as your other thread on this topic.
You don't have a
files
object in your JSON response, so usingfile()
isn't going to be able to find anything.Allan
Hey I created fresh ticket if I can get support from others, I had actually asked question how modify json on client side ?.
I tried with datasrc and data but no luck
{
"draw": 1,
"recordsTotal": 1,
"recordsFiltered": 1,
"data": [{
"propertyId": 1,
....
"propertyImages": [ ... ]
}],
"error": null,
"files": {
"propertyImages": {
"1": {
"fileId": 1,
"imageName": "p1.jpg",
"imageType": null,
"imageSize": 226347,
"imagePath": "src/main/resources/static/propertyImages/p1.jpg"
}
}
}
If you need to modify the JSON returned from the server, you could use the
dataFilter
option of thejQuery.ajax
function. In there you wouldJSON.prase()
the text response from the server, modify it as you need and thenJSON.stringify()
it for return.Allan
hey allan
thanks alot, it worked as expected now. no error when i modified json as u suggested in dataFilter.
-> next step, how to call the delete in edit->upload many? im able to call ajax for adding images in edit , but when clicked on delete button no response..
thanks
sarath
It doesn't make an Ajax call when you click the
X
icon. It simply removes the reference of the image from the current array.Allan