DataTables Editor - Upload not working
DataTables Editor - Upload not working
Ali Adnan
Posts: 47Questions: 18Answers: 1
Dear Allan,
I am just running the Upload Example from the downloaded Project (.Net version).
I am getting this error "Object reference not set to an instance of an object."
Please see the screen shot, kindly guide me what I am missing ?
Ajax load (tab)
{
"draw": null,
"data": [
{
"DT_RowId": "row_43",
"image": null,
"first_name": "Ali",
"last_name": "Adnan",
"phone": null,
"city": null
},
{
"DT_RowId": "row_61",
"image": null,
"first_name": "ALI",
"last_name": "ADNAN",
"phone": "9999999999",
"city": "KARACHI"
}
],
"recordsTotal": null,
"recordsFiltered": null,
"error": null,
"fieldErrors": [],
"id": null,
"meta": {},
"options": {},
"files": {
"files": {}
},
"upload": {
"id": null
},
"debugSql": [
{
"Query": "SELECT id as \"id\", image as \"image\", first_name as \"first_name\", last_name as \"last_name\", phone as \"phone\", city as \"city\" FROM users ",
"Bindings": []
},
{
"Query": "SELECT id as \"id\", web_path as \"web_path\", system_path as \"system_path\", filename as \"filename\", filesize as \"filesize\" FROM files ",
"Bindings": []
}
],
"cancelled": []
}
Ajax data (tab)
Submitted data:
action=create
data[0][first_name]=ALI
data[0][last_name]=ADNAN
data[0][phone]=9999999999
data[0][city]=KARACHI
data[0][image]=
Server response:
{
"draw": null,
"data": [
{
"DT_RowId": "row_61",
"image": null,
"first_name": "ALI",
"last_name": "ADNAN",
"phone": "9999999999",
"city": "KARACHI"
}
],
"recordsTotal": null,
"recordsFiltered": null,
"error": null,
"fieldErrors": [],
"id": null,
"meta": {},
"options": {},
"files": {},
"upload": {
"id": null
},
"debugSql": [
{
"Query": "INSERT INTO users ( image, first_name, last_name, phone, city ) VALUES ( :image, :first_name, :last_name, :phone, :city ) RETURNING id INTO :dtvalue",
"Bindings": [
{
"Name": ":image",
"Value": null,
"Type": null
},
{
"Name": ":first_name",
"Value": "ALI",
"Type": null
},
{
"Name": ":last_name",
"Value": "ADNAN",
"Type": null
},
{
"Name": ":phone",
"Value": 9999999999,
"Type": null
},
{
"Name": ":city",
"Value": "KARACHI",
"Type": null
}
]
},
{
"Query": "SELECT id as \"id\", image as \"image\", first_name as \"first_name\", last_name as \"last_name\", phone as \"phone\", city as \"city\" FROM users WHERE id = :where_0 ",
"Bindings": [
{
"Name": ":where_0",
"Value": "61",
"Type": null
}
]
},
{
"Query": "SELECT id as \"id\", web_path as \"web_path\", system_path as \"system_path\", filename as \"filename\", filesize as \"filesize\" FROM files ",
"Bindings": []
}
],
"cancelled": []
}
This discussion has been closed.
Answers
Dear Allan,
I am trying to debug and found that the error is through by this line
return _query._stmt.Parameters[":dtvalue"].Value.ToString();
After debuging I found that below code never execute as the _pkey always get null
as I already open a discussion https://datatables.net/forums/discussion/43445/insert-return-value-datatype-only-allowed-int-data-type#latest
and you comment that you will do this and I am sure it will solve this problem.
Please update
Best Regards
Dear Allan,
There is one more issue which is after uploading the file it will display the uploaded file in "LightBox Editor", but if we select the table row and edit the same record the attached file disappeared,
please see the data returned after upload
please see the data in edit mode but not display in editor i kept only file node below
Please see the images
Further the Relation("si_attch_rel") Table is empty the record is inserting only in master table
My controller code is
When posting screenshots, it is helpful to describe what each one represents.
Hi,
Yes, it does appear that the file upload is broken with Oracle at the moment I'm afraid. I'll be looking into that. Thanks for letting me know.
Regards,
Allan
Just a quick one to say that this now has the required fix committed and it will be in 1.6.4 which will drop soon.
I'm still working on the string primary key issue and will update that thread with progress there.
Allan