EasyUI Forum
April 24, 2024, 05:24:38 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [SOLVED] Datagrid Export only specify columns from the grid.  (Read 4521 times)
Franky
Newbie
*
Posts: 14


View Profile Email
« on: June 08, 2021, 12:47:11 AM »

Hi Sir,

Would like to ask, is there possible to export to excel/csv for specify columns only from a datagrid?

Note: I have implemented datagrid with filter and export extension, all working fine after guided by Jarry.
« Last Edit: June 15, 2021, 01:48:19 AM by Franky » Logged
Franky
Newbie
*
Posts: 14


View Profile Email
« Reply #1 on: June 12, 2021, 06:22:55 PM »

Bump, anyone can please help?
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #2 on: June 14, 2021, 03:40:39 PM »

Please specify the 'fields' parameter while calling the 'toCsv' or 'toExcel' methods. Be sure to download a newer version from https://www.jeasyui.com/extension/datagrid_export.php
Code:
$('#dg').datagrid('toCsv', {
    filename: 'datagrid.csv',
    fields: ['itemid','productid'],
    rows: rows,
    footer: [{
        productid: 'Summary',
        listprice: 30
    },{
        productid: 'Summary',
        listprice: 40
    }]
});
Logged
Franky
Newbie
*
Posts: 14


View Profile Email
« Reply #3 on: June 15, 2021, 12:20:48 AM »

Please specify the 'fields' parameter while calling the 'toCsv' or 'toExcel' methods. Be sure to download a newer version from https://www.jeasyui.com/extension/datagrid_export.php
Code:
$('#dg').datagrid('toCsv', {
    filename: 'datagrid.csv',
    fields: ['itemid','productid'],
    rows: rows,
    footer: [{
        productid: 'Summary',
        listprice: 30
    },{
        productid: 'Summary',
        listprice: 40
    }]
});

Hi Jarry,

Thanks again for your help. This new enhancement work pretty good and as expected.
Thanks ya bro!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!