Results 1 to 2 of 2

Thread: generate report from grid to excel

  1. #1

    Default generate report from grid to excel

    how can I generate a report to excel from my grid, I mean can export the rows of my grid to excel, some suggestion??

  2. #2
    Sencha User dlbjr's Avatar
    Join Date
    Oct 2007
    Cache, OK USA

    Default something to toy with

    This code takes a grid's store and preps it for Excel and places it in the clipboard.
    You should be able to throw it into a new window and set it to an Excel file

    function copyGridDataToClipboard(grid) {
     var s = new StringBuilderEx();
     var col;
     var visibleCols = grid.getColumnModel().getColumnsBy(
      function(columnConfig, index) {
       if (columnConfig.hidden) {
        return false
       else {
        return true;
     var rec = 0;
     var selRecords = grid.getSelectionModel().getSelections();
     for (rec = 0; rec < selRecords.length; rec++) {
      for (col = 0; col < visibleCols.length; col++) {
       var colIdxName = "";
       colIdxName += visibleCols[col].dataIndex;
       /* Excel needs a tab in between columns */
       s.append(selRecords[rec].get(visibleCols[col].dataIndex) + '\t');
     window.clipboardData.setData('text', s.toString());
    dlbjr - David L. Bryant Jr.

    Owner of
    dlbjr Technology Consulting
    Web2 System Developer & Consultant
    Focused on C.I. - Six Sigma - Shingo - Lean Technologies
    [email protected]

    Owner of:
    Attractive Graphics - "custom screen printing"
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts