hi, i have a datatable which to click open a form that contains an object with multiple uploader = true and a list of uploader type .
When I close the form and then reopen the list is not " downloaded files added ," despite face $$ ( list) .clearAll ( ) .
How can I do? Thank you
despite face $$ ( list) .clearAll ( )
First of all, note that on the each successful upload the list becomes empty.
The uploader’s data stored as the DataCollection (available as uploader.files
). More information you can find here.
You can work with it the same way as with a usual Data Collection: add, delete, etc.
Hi,
Can you please provide a snippet of the issue?
this is the form:
var form_list_media = {
view:"form",
id:"form_list_media",
elements:[
{ cols:[
{
id:"datatable_media",
view:"datatable",
select:"row",
height:500,
columns:[
{ id:"id", header:"Id", hidden:false},
{ id:"cServer", header:"Server", fillspace:true},
{ id:"cFileMedia", header:"File", fillspace:true}
]
},
{
view:"form",
id:"frmFillMedia",
elements:[
{
view:"uploader",
upload:"php/upload.php",
accept:"image/png, image/gif, image/jpg, image/jpeg",
id:"upl_file",
name:"upl_file",
value:"Add File",
link:"medialist",
autosend:false,
multiple:true
},
{ view:"list", autoheight:true, scroll:true, id:"medialist", type:"uploader",borderless:true },
{ view: "button", label: "Save files", click: Send_File}
]
}
]
}
]
};
this is the function Send
function Send_File(){
var idcampaign = $$('datatable_campaign').getSelectedItem().id;
var idproperty = $$('datatable_inspection').getSelectedItem().property_id;
var idactivity = $$('datatable_inspection').getSelectedItem().id;
$$("upl_file").send(function(response){
if(response)
if(response.status=="server"){ //upload ok
var s = { "IdActivity":idactivity, "IdOwner":idowner, "IdCampaign": idcampaign, "IdProperty": idproperty }
webix.ajax().post("upload_file.php", s ,function(text,data) {
var item = $$('datatable_inspection').getSelectedItem();
var idactivity = item['id'];
$$('datatable_media').clearAll();
$$('datatable_media').load("load.php?cmd=load_list_media&idactivity="+idactivity);
});
}
},
{
IdOwner:idowner,
IdCampaign:idcampaign,
IdProperty:idproperty
}
);
}
when i hide the form i clear the list! but when open form and add a file in the list i see two file! current file and previous file then had attach after
i risolve the problem only if setting uploader with parameter multiple:false
sorry, same error with parameter multiple:false
the problem is this:
i add files to uploader,send file or files and hide the form.
When open the form, i clear the list of media but
var order = $$(“upl_file”).files.data.order
order is not empty! there is previous file! can i remove manual the files of uploader?
thanks
Please use
$$("uploader").files.data.clearAll();
to delete the data directly from the datastore
ok thanks! it’s work!