1. #11
    Ext JS Premium Member Foggy's Avatar
    Join Date
    Apr 2007
    Location
    Switzerland
    Posts
    477
    Vote Rating
    0
    Foggy is on a distinguished road

      0  

    Default


    Really nice extension, thanks for that animal.
    Maybe a better solution would be to send the Excel xml to a backend and create a file? In this case you are not rely on any browser stuff...

  2. #12
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Well, if there's going to be a backend involved, it's better that that should just produce the XML itself. It has all the data, so it should just be able to process it into a valid XML spreadsheet. In our app, we have an Excel export button, but it just requests a document to be generated from the server, it does not send any info up.

  3. #13
    Ext JS Premium Member Foggy's Avatar
    Join Date
    Apr 2007
    Location
    Switzerland
    Posts
    477
    Vote Rating
    0
    Foggy is on a distinguished road

      0  

    Default


    it's better that that should just produce the XML itself. It has all the data, so it should just be able to process it into a valid XML spreadsheet.
    Of course, you are right

  4. #14
    Sencha User galdaka's Avatar
    Join Date
    Mar 2007
    Location
    Spain
    Posts
    1,166
    Vote Rating
    -1
    galdaka is an unknown quantity at this point

      0  

    Default


    Works fine!!

    Good work!!

  5. #15
    Ext User
    Join Date
    Mar 2007
    Posts
    10
    Vote Rating
    0
    ghyster is on a distinguished road

      0  

    Default


    I found some bug with a grid containing hidden columns, there is a mismatch between excel cells type and values when you have different types of data

    when retrieving the cell types I added a specific var for incrementation:

    Code:
    var k=0;
    for (var j = 0; j < cm.getColumnCount(); j++) {
    	if (includeHidden || !cm.isHidden(j)) {
    		var v = r[cm.getDataIndex(j)];
    		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++;
    	}
    }
    It works for me with this update

    One more thing : why don't you use a basic toolbar button for exporting, which will automatically refresh the data url like this :

    Code:
    bbar: new Ext.Toolbar({
            	buttons: [{
        			id: 'grid-excel-button',
        			text: 'Excel',
    			handler: function(){
    				document.location='data:application/vnd.ms-excel;base64,' +Base64.encode(grid.getExcelXml());
    			}
        		}]
    	})

  6. #16
    Sencha User
    Join Date
    Aug 2007
    Location
    Munich, Germany
    Posts
    135
    Vote Rating
    0
    gelleneu is on a distinguished road

      0  

    Default


    And it will only works on ie8+ ? @Galdaka: you tested it on IE6?

  7. #17
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Quote Originally Posted by ghyster View Post
    I found some bug with a grid containing hidden columns, there is a mismatch between excel cells type and values when you have different types of data

    when retrieving the cell types I added a specific var for incrementation:

    Code:
    var k=0;
    for (var j = 0; j < cm.getColumnCount(); j++) {
    	if (includeHidden || !cm.isHidden(j)) {
    		var v = r[cm.getDataIndex(j)];
    		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++;
    	}
    }
    It works for me with this update

    One more thing : why don't you use a basic toolbar button for exporting, which will automatically refresh the data url like this :

    Code:
    bbar: new Ext.Toolbar({
            	buttons: [{
        			id: 'grid-excel-button',
        			text: 'Excel',
    			handler: function(){
    				document.location='data:application/vnd.ms-excel;base64,' +Base64.encode(grid.getExcelXml());
    			}
        		}]
    	})
    OK, thanks for this info. Can you bump this thread tomorrow, and I'll try ity out with hidden columns and fix it.

    Yes, I was thinking of different ways to make the download smoother, if that works in all cases, I'll change the demo to use that.

  8. #18
    Ext User
    Join Date
    Apr 2008
    Posts
    3
    Vote Rating
    0
    anujg is on a distinguished road

      0  

    Default server side excel

    server side excel


    Great plugin Animal, I have a server side paging in my grid and I want to be able to export to excel , doing it on the server side is fine with me, but how do I bring up a file download dialog box once the data is back from the server? I am quite new to Ext and this simple thing is taking me a long time...

    Also, in my toolbar I have a button "export to Excel" , and I want it to export only the data on the current page, not the whole store data, so how do I pass along the current data to the server side to generate a XML? any ideas ?

  9. #19
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    If you just want the current page, then you can do it on the client.

    If you are doing it on the server, that's totally up to you.

  10. #20
    Ext JS Premium Member
    Join Date
    Dec 2007
    Posts
    213
    Vote Rating
    0
    sanjshah is on a distinguished road

      0  

    Default


    Hi,

    I'm testing this but getting an error message:

    PHP Code:
    unterminated string constant 
    Any help? please!

Thread Participants: 142

  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. zaburo (1 Post)
  140. shankar8rajah1 (1 Post)
  141. tdobberphul (4 Posts)
  142. jramis (1 Post)