1. #131
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    301
    Vote Rating
    2
    emredagli is on a distinguished road

      0  

    Default


    (By putting break point on FIREBUG) Check the,
    var vExportContent = grid.getExcelXml();
    parameter.

  2. #132
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    vvreddy@12 is on a distinguished road

      0  

    Default


    Hi,

    I have put a break point in the firebug and found the result int the xml format. The problem which I am facing is not with firefox but with IE. The code is working fine with firefox and is not working with IE.

    Please find the result of the variable vExportContnet as an attachment and at the same time I am sending my code to you.

    Thanks,
    Vishnu
    Attached Files

  3. #133
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,506
    Vote Rating
    54
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Could your problem be something to do with not reading the very first line in ths thread?

    This needs a browser that supports data URLs. FF, Opera and IE8 will support this.

  4. #134
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    vvreddy@12 is on a distinguished road

      0  

    Default export gridpanel to excel

    export gridpanel to excel


    Hi Animal,

    I have seen that line in the early conversations but there was a thread given by emredagli in which he specified that he could export the data into an excel using IE 7. So we have started to use that piece of code in your code.

    Thanks,
    Vishnu

  5. #135
    Sencha User emredagli's Avatar
    Join Date
    Jun 2008
    Posts
    301
    Vote Rating
    2
    emredagli is on a distinguished road

      0  

    Default


    Hi vvreddy,
    unfortunately, I haven't work with jsp files. Actually I test my code by using aspx files in .NET.
    I want to ask firstly, What did you mean as getting blank page? If when you try to open document in excel and getting improper format, The problem may related with:
    Code:
            fields: [
               {name: 'company'},
               {name: 'price', type: 'float'},
               {name: 'change', type: 'float'},
               {name: 'pctChange', type: 'float'},
               {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
            ]
    In "company" field, it's type isn't declared.
    Or you can try by giving all formats as string (I used as string to all fields).

    The second is if you change the part:
    Code:
              if (Ext.isIE6 || Ext.isIE7 || Ext.isSafari || Ext.isSafari2 || Ext.isSafari3) {
                  var dataURL = '../jsp/exportexcel.jsp';
                  params =[{
                       name: 'ex',
                       value: vExportContent 
                  },{
                      name: 'FileName',
                      value: 'excel.xls'
                  }];
                  post_to_url(dataURL, params, 'post');
              } else {
                    
                  document.location = 'data:application/vnd.ms-excel;base64,' + Base64.encode(vExportContent);
              }
    AS

    Code:
                  var dataURL = '../jsp/exportexcel.jsp';
                  params =[{
                       name: 'ex',
                       value: vExportContent 
                  },{
                      name: 'FileName',
                      value: 'excel.xls'
                  }];
                  post_to_url(dataURL, params, 'post');
    You can test it in Firefox. Try this and look at the response you send in firebug.

    And also I change the format of the file "result.txt" (you sended) as "result.xls". And I can open it in excel. (Problem probably related with jsp... )

    I hope you solve the problem.
    Good luck.

  6. #136
    Sencha User
    Join Date
    Dec 2008
    Location
    NYC
    Posts
    182
    Vote Rating
    0
    whodat is on a distinguished road

      0  

    Thumbs up


    Quote Originally Posted by Animal View Post
    Obviously this only works on the data in the Store - if you are using server-side paging, then perform this processing on the server. For quick and dirty conversion of a small table to Excel, this might be useful.
    Hi Animal.. great user extension and I was able to get this working in IE7 and FF3.

    Quick question/possible bug in regards to the statement above.

    I am using paging but decided to do it on the client side with Condor's extension. So I have all of the data on the client side in my grid's store. But when exporting to excel, I only get the rows visible to the grid. Any suggestions as to why?

    Digging a lil into your code, I found the following comments and code
    Code:
    // Generate the data rows from the data in the Store
            for (var i = 0, it = this.store.data.items, l = it.length; i < l; i++) {
                t += '<ss:Row>';
                var cellClass = (i & 1) ? 'odd' : 'even';
                r = it[i].data;
                var k = 0;
                for (var j = 0; j < cm.getColumnCount(); j++) {
                    if (includeHidden || !cm.isHidden(j)) {
                        var v = r[cm.getDataIndex(j)];
                        if (cellType[k] !== "None") {
    
                            t += '<ss:Cell ss:StyleID="' + cellClass + cellTypeClass[k] + '"><ss:Data ss:Type="' + cellType[k] + '">';
                                if (cellType[k] == 'DateTime') {
                                    t += v.format('Y-m-d');
                                } else {
                                    t += v;
                                }
                            t +='</ss:Data></ss:Cell>';
                        }
                        k++;
                    }
                }
                t += '</ss:Row>';
            }
    Does this piece actually take all data present in the store, because it does not seem to...

    Please let me know and thanks again for the extension.

  7. #137
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,506
    Vote Rating
    54
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Whuhhhhh?

    MUST prevent myself going into Cox mode... MUST.....


  8. #138
    Sencha User
    Join Date
    Dec 2008
    Location
    NYC
    Posts
    182
    Vote Rating
    0
    whodat is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    Whuhhhhh?
    I'm no sure I get you, I don't watch scrubs but I know dude in the pic is on that show.

    If you're stating that this extension was just a way to illustrate the capabilities then yes, I understand you.

    My concern was this this.store.data.items I thought this had all items in the store and not what was only loaded into the grid and I was paging locally and not on the server how could I get all of the records exported without loading the grid.

  9. #139
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,506
    Vote Rating
    54
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    The Store can only expose what is in the current page, so you will only ever get the current page from the Store. If it didn't do this, it wouldn't be paged.

    If you are using Condor's paging Store, then you need to ask him how to access the "real" Store containing the whole dataset, and use that.

  10. #140
    Ext User
    Join Date
    Feb 2008
    Posts
    275
    Vote Rating
    0
    Rafael is on a distinguished road

      0  

    Default


    i try but have a error in my code:

    unterminated string literal
    in line:
    '<ss:Cell ss:StyleID="title" ss:MergeAcross="' + (visibleColumnCount - 1) + '">' +

Thread Participants: 140

  1. alexb (1 Post)
  2. galdaka (3 Posts)
  3. ghyster (1 Post)
  4. Condor (1 Post)
  5. TopKatz (1 Post)
  6. Jul (1 Post)
  7. mystix (3 Posts)
  8. Foggy (2 Posts)
  9. bloon (1 Post)
  10. fshort (1 Post)
  11. antimatter15 (1 Post)
  12. cocinerox (1 Post)
  13. tobiu (1 Post)
  14. ajaxE (2 Posts)
  15. andreyz (1 Post)
  16. devnull (4 Posts)
  17. mjlecomte (4 Posts)
  18. kevinwu8 (1 Post)
  19. rakesh (1 Post)
  20. hendricd (2 Posts)
  21. gelleneu (1 Post)
  22. isaac (1 Post)
  23. huling (1 Post)
  24. ckr (1 Post)
  25. roopa (1 Post)
  26. loveyeah (1 Post)
  27. zhfxu_cs (1 Post)
  28. Mthor (1 Post)
  29. johnlicy (1 Post)
  30. thoreking (2 Posts)
  31. csqjean (1 Post)
  32. mankz (1 Post)
  33. vietschv (1 Post)
  34. verbi (1 Post)
  35. sanjshah (2 Posts)
  36. mask_hot (1 Post)
  37. calavera (1 Post)
  38. vsmike (1 Post)
  39. vizcano (1 Post)
  40. lakehouse (1 Post)
  41. alaska (2 Posts)
  42. radtad (3 Posts)
  43. jmcneese (1 Post)
  44. Rafael (4 Posts)
  45. calvouze (1 Post)
  46. Joyfulbob (1 Post)
  47. angeldimitrov (2 Posts)
  48. Jack_S (2 Posts)
  49. g13013 (2 Posts)
  50. DamienValentine (5 Posts)
  51. Marcelo Delgado (1 Post)
  52. NoahK17 (8 Posts)
  53. anujg (1 Post)
  54. aproust94 (3 Posts)
  55. pokerking400 (1 Post)
  56. Ronhead (1 Post)
  57. krzak (3 Posts)
  58. cvieira (1 Post)
  59. Efex (5 Posts)
  60. gthe (2 Posts)
  61. miihiir (2 Posts)
  62. pops (1 Post)
  63. emredagli (12 Posts)
  64. larsa (2 Posts)
  65. maggiesnyder (3 Posts)
  66. sam.zhang (1 Post)
  67. kristalgic (1 Post)
  68. wiznia (3 Posts)
  69. frpucci (1 Post)
  70. tinakonda (1 Post)
  71. tBSTAR (1 Post)
  72. tdg2008 (1 Post)
  73. iwagon (1 Post)
  74. psarunkumar (1 Post)
  75. kimmking (1 Post)
  76. sKuD24 (1 Post)
  77. MartinL (2 Posts)
  78. BitPoet (2 Posts)
  79. snoir (3 Posts)
  80. naranda (1 Post)
  81. zhw511006 (1 Post)
  82. bobjbain (1 Post)
  83. korto (1 Post)
  84. wp.joju (1 Post)
  85. hastiok (6 Posts)
  86. dtondo (4 Posts)
  87. Dumas (1 Post)
  88. vvreddy@12 (4 Posts)
  89. TheBim (1 Post)
  90. whodat (2 Posts)
  91. Skunkerbr (2 Posts)
  92. stevenhzj (4 Posts)
  93. Naokai (1 Post)
  94. wayned@escc (2 Posts)
  95. MuadDib-DK (1 Post)
  96. jsundquist (1 Post)
  97. hardc0re (2 Posts)
  98. hzwei (4 Posts)
  99. Galileo_Galilei (1 Post)
  100. SantaBarbarian (4 Posts)
  101. stevieke (1 Post)
  102. megmefleg (1 Post)
  103. Boccara Jonathan (1 Post)
  104. Surinder singh (2 Posts)
  105. KrullWarKing (1 Post)
  106. brandnewdrew (1 Post)
  107. MrRoyce (1 Post)
  108. Spongerusher (1 Post)
  109. teraphy (2 Posts)
  110. Pekka Karalahti (3 Posts)
  111. Sergii (1 Post)
  112. Cassio11 (1 Post)
  113. myth (1 Post)
  114. spor (6 Posts)
  115. StagnantIce (2 Posts)
  116. shailendra (2 Posts)
  117. ext_user1 (1 Post)
  118. kenny_mk (1 Post)
  119. mpacheco (1 Post)
  120. Centurus (1 Post)
  121. andyfly (1 Post)
  122. darmandovargas@gmail.com (1 Post)
  123. zjuthhy (3 Posts)
  124. robshim (3 Posts)
  125. Tod (1 Post)
  126. bipen (2 Posts)
  127. alisyah (1 Post)
  128. Monz87 (1 Post)
  129. alssst (1 Post)
  130. aggie (1 Post)
  131. bradelsky (1 Post)
  132. lagrezd (1 Post)
  133. ma1986 (1 Post)
  134. Sabareesh (2 Posts)
  135. top_1 (1 Post)
  136. Vasanthoo7 (1 Post)
  137. garrek99 (2 Posts)
  138. opik (1 Post)
  139. shankar8rajah1 (1 Post)
  140. tdobberphul (4 Posts)