thiagopedro Posted June 15, 2018 Share Posted June 15, 2018 how can I use this js code in unigui? Ext.onReady(function () { var grid = Ext.widget({ xtype: 'grid', height: 400, store: { fields: ['name', 'size', 'progress', 'status'] }, tbar: [{ xtype: 'filefield', buttonOnly: true, width: 10, listeners: { render: function (s) { s.fileInputEl.set({ multiple: 'multiple' }); }, change: function (s) { Ext.each(s.fileInputEl.dom.files, function (f) { var data = new FormData(), rec = grid.store.add({ name: f.name, size: f.size, status: 'queued' })[0]; data.append('file', f); Ext.Ajax.request({ url: '/upload/files', rawData: data, headers: { 'Content-Type': null }, //to use content type of FormData progress: function (e) { rec.set('progress', e.loaded / e.total); rec.set('status', 'uploading...'); rec.commit(); }, success: function () { rec.set('status', 'done'); rec.commit(); }, failure: function () { rec.set('progress', 0); rec.set('status', 'failed'); rec.commit(); } }); }); } } }], columns: [ { text: 'Name', dataIndex: 'name', flex: 1 }, { text: 'Status', dataIndex: 'status', width: 100 }, { text: 'Progress', xtype: 'widgetcolumn', widget: { xtype: 'progressbarwidget', textTpl: [ '{percent:number("0")}%' ] }, dataIndex: 'progress', width: 100 }, { text: 'Size', dataIndex: 'size', width: 100, renderer: Ext.util.Format.fileSize } ], renderTo: Ext.getBody() }); }); thanks for the help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 15, 2018 Share Posted June 15, 2018 Hi, This post can help you: http://forums.unigui.com/index.php?/topic/2490-multiple-file-upload/page-2&do=findComment&comment=38734 Quote Link to comment Share on other sites More sharing options...
thiagopedro Posted June 15, 2018 Author Share Posted June 15, 2018 They are different procedures. What you have indicated is drag and drop. This is "select files". I just need to know how to fit to load this event and associate it with a component. Quote Link to comment Share on other sites More sharing options...
mhmda Posted June 16, 2018 Share Posted June 16, 2018 It is all available in unigui framework, except the progressbar that indicates the ‰ of the upload process, if you want to handle it manually you have also to handle server side code, anyway you may use the event 'viewready' in the clientevents of the grid and then for the specific column add your progress bar, also you may use the column renderer event to insert the progressbar. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.