Problem with upload file
Problem with upload file
cala
Posts: 52Questions: 15Answers: 0
Hi to everybody!
I'm trying to upload a file on my table, but... I'm losing my head!
I have created the 2 different tables, one for the "informations" and one for the uploaded files. I can see that the structure of the Server interaction is not in the good form, but I cannot understand what I have to change. Here my js code:
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
"ajax": {
"url": "../scripts/server_processing_editor_9_9.php",
"type": "POST"
},
"table": "#protocol_table",
fields: [
{
label: "Protocollo",
name: "wp__register._register_protocollo"
},{
label: "Prenotato da:",
name: "wp__register._register_user"
},{
label: "Data immissione:",
name: "wp__register._register_data_imm",
type: "date",
//def: function () { return new Date(); },
//dateFormat:'d/m/Y'
},{
label: "Anno ecclesiastico:",
name: "wp__register._register_anno_eccl"
},{
label: "Sotto-codice:",
name: "wp__register._register_sotto_cod",
type: "select",
options: [
{ label: "aRM", value: "aRM" },
{ label: "pRM", value: "pRM" },
{ label: "aPT", value: "aPT" },
{ label: "pPT", value: "pPT" }
]
},{
label: "Data documento:",
name: "wp__register._register_data_doc"
},{
label: "Riferimento:",
name: "wp__register._register_rif"
},{
label: "Nomero ordine:",
name: "wp__register._register_num_ord"
},{
label: "Tipo doc:",
name: "wp__register._register_tipo_doc",
type: "select",
options: [
{ label: "Lettera", value: "Lettera" },
{ label: "Fax", value: "Fax" },
{ label: "Email", value: "Email" }
]
},{
label: "Mittente:",
name: "wp__register._register_mittente"
},{
label: "Destinatario:",
name: "wp__register._register_destinatario"
},{
label: "Oggetto:",
name: "wp__register._register_oggetto"
},{
label: "Per mod:",
name: "wp__register._register_per_mod",
type: "select",
options: [
{ label: "Si", value: "Si" },
{ label: "No", value: "No" }
]
},
{
label: "Image:",
name: "wp__register._register_file_list",
type: "upload",
display: function ( id ) {
return '<img src="'+table.file( 'files', file_id ).web_path+'"/>';
},
clearText: "Clear",
noImageText: 'No image'
}
],
} );
var table=$('#protocol_table').DataTable( {
"processing": true,
"bserverSide": true,
"ajax": {
"url": "../scripts/server_processing_editor_9_9.php",
"type": "POST"
},
columns: [
{
"className": 'details-control',
"orderable": false,
"data": null,
"defaultContent": ''
},
{ data: "wp__register._register_protocollo" },
{ data: "wp__register._register_user" },
{ data: "wp__register._register_data_imm" },
{ data: "wp__register._register_anno_eccl" },
{ data: "wp__register._register_sotto_cod" },
{ data: "wp__register._register_data_doc" },
{ data: "wp__register._register_rif" },
{ data: "wp__register._register_num_ord" },
{ data: "wp__register._register_tipo_doc" },
{ data: "wp__register._register_mittente" },
{ data: "wp__register._register_destinatario" },
{ data: "wp__register._register_oggetto" },
{ data: "wp__register._register_per_mod" },
{ data: "wp__register._register_file_list",
render: function ( file_id ) {
return file_id ?'<img src="'+table.file( 'files', file_id ).web_path+'"/>' :null;},
defaultContent: "No image",
title: "Image"
}
],
"select": true,
dom: 'Bfrtip',
buttons: [
{ text: 'Reload',
action: function ( e, dt, node, config ) {
//alert("I am an alert box!");
dt.ajax.reload();
}},
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor }
],
} );
$('#protocol_table tbody').on('click', 'td.details-control', function () {
var tr = $(this).closest('tr');
var row = table.row( tr );
if ( row.child.isShown() ) {
// This row is already open - close it
row.child.hide();
tr.removeClass('shown');
}
else {
// Open this row
row.child( format(row.data()) ).show();
tr.addClass('shown');
}
} );
} );
}
This discussion has been closed.
Answers
sorry for the consecutive post...
and the server processing file:
the debug report is in http://debug.datatables.net/odudoy ...
Thank you for the help!