PDA

View Full Version : multi upload grid



ApacheLogs
25 Nov 2009, 7:24 AM
Hi,
I'm using a datagrid to upload files and i have a problem im recuperating only one file
using an extension for grid itemdeleter and i post this part of code :



var itemDeleter_file = new Extensive.grid.ItemDeleter();

var file = Ext.data.Record.create([{
namefile : '',
file_model : ''
}]);

var fileProxy = new Ext.data.MemoryProxy({
root: [{
namefile: '',
file_model:''
}]
});

var store_related_files = new Ext.data.Store({
reader: new Ext.data.JsonReader({
root: "root"
}, file),
proxy: fileProxy
});
var i= 0;
//files grid

var grid_related_files = new Ext.grid.EditorGridPanel({
width : 440,
id : 'grid_related_files',
height : 120,
store : store_related_files,
selModel: itemDeleter_file,
clicksToEdit:2,
tbar:
[
{
text : 'Ajouter',
iconCls : 'add',
handler : function()
{
store_related_files.add(new file({
namefile: 'Nouveau fichier',
file_model :''
}));
}
}
],
cm: new Ext.grid.ColumnModel(
[
new Ext.grid.RowNumberer(),
{
header : 'Nom du fichier',
width : 130,
dataIndex : 'namefile',
editor : new Ext.form.TextField({allowBlank: false})
},
{
// id: 'file_model',
header: 'fichier model',
dataIndex: 'file_model',
width: 220,
// use shorthand alias defined above
editor: new Ext.form.FileUploadField ({
name : 'test',
id : 'test',
buttonOnly : true,
buttonCfg: {
width:120,
iconCls: 'upload'
}
})
}, itemDeleter_file
]
)
});

when im trying to upload i recuparate only one file
can any one help me

jay@moduscreate.com
25 Nov 2009, 8:09 AM
Please refrain from posting duplicates.


How are you doing an upload without a form element?

ApacheLogs
25 Nov 2009, 8:46 AM
thanks for replying,
i'm sorry for posting twice,
this part of code exist in a form of corse
but the problem exactly is that in php file
when i do var_dump($_file['test']['tmp_name']) i recupare only the first file

jay@moduscreate.com
25 Nov 2009, 8:59 AM
ah yes! that's because that entire column has one editor.
The editor grid was not designed in the way that you're thinking.

ApacheLogs
25 Nov 2009, 9:10 AM
thanks jgarcia
but there is any solution for this,
can i do a coallback function that update element,what can you advice me to do?

jay@moduscreate.com
25 Nov 2009, 9:22 AM
well, you should not use an Editor grid for file uploads - it's simple.

Create a dynamic form that takes care of that.
Look at: http://www.extjs.com/forum/showthread.php?t=82569