EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on December 01, 2016, 05:31:44 AM



Title: datagrid + filebox
Post by: rezzonico on December 01, 2016, 05:31:44 AM
Hi all,

I am trying (without success) to add a "filebox" field to a datagrid.
Is it possible ?
Can someone point me to an example ?

Thanks
Miche


Title: Re: datagrid + filebox
Post by: stworthy on December 01, 2016, 05:02:19 PM
If you are using the inline editing feature, please set the 'editor' property to 'filebox'.


Title: Re: datagrid + filebox
Post by: rezzonico on December 02, 2016, 03:34:42 AM
Thanks

Regards
Miche


Title: Re: datagrid + filebox
Post by: rezzonico on December 07, 2016, 06:30:56 AM
Hi all,

I have a datagrid with the field "Pdf".
The type of the field "Pdf" is "filebox".

I am adding the new lines with the following code:

Code:
var rows = $('#dg').datagrid('getChanges','inserted');
for (var i=0; i<rows.length; i++) {
   var row = rows[i];
   params['Pdf'] = ???????????????;
   $.post(url, params, function() {}, 'json');
}

My question is:
how can I reference the content of the field "Pdf" (the content of the file that I need to upload) ?


Thanks
Miche


Title: Re: datagrid + filebox
Post by: rezzonico on December 09, 2016, 01:09:37 AM
Some more information ...

in my program I am able to upload the file content of an input field (class="easyui-filebox") with the code below.
The problem is how to use this code with a filebox field in a datagrid.

In other words:

if in case of an input field (class="easyui-filebox") the variable "f" is:
var f = $('#Pdf').next().find('.textbox-value');

what would it be in case the filebox is a field in a datagrid ?


Thanks for any help.
Miche

Code:
         var form_data = new FormData();
         var f = $('#Pdf').next().find('.textbox-value');
         file_data = f[0].files[0];
         form_data.append('Pdf', file_data);

         $.ajax({
            url: 'upload.cgi',
            data: form_data,
            ...
         });