Editor Photo Upload
Editor Photo Upload

Hi, i am following the below example, and trying to integrate file uploading into my code.
https://editor.datatables.net/manual/upload#Client-side
But i get an error, -> Uncaught TypeError: products_editor.file is not a function(…)
Any suggestions please.
Here is my code;
var products_editor = new $.fn.dataTable.Editor( {
i18n: {
create: { button: "Yeni", title: "Yeni Kayıt", submit: "Kaydet" },
edit: { button: "Düzenle", title: "Kayıt Düzenle", submit: "Kaydet" },
remove: { button: "Sil", title: "Kayıt Sil", submit: "Sil", confirm: { _: "%d Bu kayıtları silmek istiyor musunuz?", 1: "Bu kaydı silmek istiyor musunuz?"}},
error: { system: "Sistem hatası oluştu."},
multi: { title: "Çoklu seçim.", info: "Farklı değerler içeren bilgileri düzenlemek için seçimleri tekli yapın.", restore: "Değişiklikleri iptal et."},
datetime: { previous: 'Önceki', next: 'Sonraki',
months: [ 'Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık' ],
weekdays: [ 'Paz', 'Pzts', 'Salı', 'Çarş', 'Perş', 'Cuma', 'Cmst' ]}
},
ajax: {
url: 'products_crud.php',
beforeSend: function () {
//document.getElementsByClassName("btn")[0].setAttribute("disabled","disabled");
},
data: function ( d ) {
var selected = producttypes_table.row( { selected: true } );
if ( selected.any() ) {
d.secilen_id = selected.data().producttypes.id;
//console.log('Secilen ID',selected.data().companies.id); //dogrusu
}
}
},
table: '#products',
fields: [
{ label: "Ürün Adı:", name: "products.name"},
{ label: "Ürün Kategorisi:", name: "products.producttype", type: "select2"},
{ label: "Birimi:", name: "products.unit", type: "select2"},
{ label: "Para Birimi:", name: "products.currency", type: "select2"},
{ label: "Birim Fiyat:", name: "products.price"},
{ label: "Stokta", name: "products.active", type:"checkbox", separator: "|", options: [{ label: '', value: 1 }]},
{ label: "Stok Miktarı:", name: "products.stock"},
{ label: "Not:", name: "products.note", type:"textarea"},
{
label: "Image:",
name: "products.photo",
type: "upload",
display: function ( id ) {
return '<img src="'+products_editor.file( 'images', id ).webPath+'"/>';
},
noImageText: 'No image'
}
]
} );
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
sorry, i solved the problem.
You can close the post.
Thanx.
Thanks for posting back - great to hear you've got it working!
Allan