jqgriddownload

1.8.1 • Public • Published

jqgrid_download

jqgrid_download is a convenient simple csv download plugin for the free-jqgrid.

Add an import tag to your html website

 <script type="text/javascript" src="https://foo.com/node_modules/jqgriddownload/dist/jqgriddownload.js"></script>

Declare a CSV OR Excel button in your Grid init

.jqGrid("navButtonAdd", "#grid_toppager", {
        caption: "Download CSV",
        id:"download",
        buttonicon: "fa-file-excel-o",
        onClickButton: function(err,res){
         jQuery(this).jqGrid("jqgrid_download",'csv');
        }
  }).jqGrid("navButtonAdd", "#grid_toppager",
  {
    caption: "Excel",
    id: "Excel",
    buttonicon: "fa-file-excel-o",
    onClickButton: function(err, res)
    {
      jQuery(this).jqGrid("jqgrid_download", 'xlsx');
    }
  });

Nother example:

  jQuery("#grid").jqGrid(
  {
    colModel: col_model,
    data: data,
    loadonce: true,
    beforeRequest: function(id)
    {
      setTimeout(function()
      {
        waitingDialog.hide();
      }, 1000);
    },
    rownumbers: true,
    iconSet: 'fontAwesome',
    searching:
    {
      defaultSearch: "bw"
    },
    pagger: true,
    rowNum: 50,
    sortname: "invdate",
    sortorder: "desc",
    toppager: true,
    caption: 'Pictures',
    logger: 'jqgriddownload',
    autowith: true,
    shrinkToFit: false,
    cmTemplate:
    {
      autoResizable: true,
      editable: true
    }
  }).jqGrid("filterToolbar",
  {
    searchOnEnter: true,
    enableClear: false
  }).jqGrid("gridResize").jqGrid("inlineNav",
  {
    edit: false,
    add: false,
    save: true,
    cancel: true
  }).jqGrid("navButtonAdd", "#grid_toppager",
  {
    caption: "Excel",
    id: "Excel",
    buttonicon: "fa-file-excel-o",
    onClickButton: function(err, res)
    {
      jQuery(this).jqGrid("jqgrid_download", 'xlsx');
    }
  });

Sponsors:

Jqgriddownload

GPL licenses Module to Download CSV or Excel files from Jqgrid

Jqgriddownload~is_int(--)

Kind: inner method of Jqgriddownload

Param Type Description
-- string check if integer

Jqgriddownload~eachColumnInRange(ws)

Kind: inner method of Jqgriddownload

Param Type Description
ws string format: csv or xlsx

Jqgriddownload~date_formatter(cell_value, format) ⇒ string

Kind: inner method of Jqgriddownload
Returns: string - = string like '02/06/2023'
Example:: your col_model : .... {'name': 'order_date', 'download_formatter': 'date_formatter--dd/mm/yyyy'}, ....

Param Type Default Description
cell_value string cel_value as a string, for the moment only iso 112 20230602 is supported
format string "dd/mm/yyyy" format, style like 'dd/mm/yyy'

Jqgriddownload~date_to_string(date, y) ⇒ string

Kind: inner method of Jqgriddownload
Returns: string - = string like '02/06/2023'
Example:: let d = new Date(); let x = date_to_string(d,'dd/mm/yyyy'); console.log(x);

Param Type Description
date object date object
y string format, style like 'dd/mm/yyy'

Package Sidebar

Install

npm i jqgriddownload

Weekly Downloads

1

Version

1.8.1

License

GPL-3.0-or-later

Unpacked Size

57 kB

Total Files

14

Last publish

Collaborators

  • veto64