asifashfaq opened a new issue #971:
URL: https://github.com/apache/royale-asjs/issues/971


   
   
   issues:
   1. width and height properties not working for mx:DownloadButton when we 
give width and height button was not clicking.
   2. i have data in bytes[ ]. after downloading file. files original size 
increased and output changed. screen shot attached.
   
   Backend Code.
   public class shmAttachmentsVO implements Serializable {
         private byte[] at_Bytes = null;
     public byte[] getAt_Bytes() {
         return at_Bytes;
     }
     public void setAt_Bytes(byte[] ArrAt_Bytes) {
         at_Bytes = ArrAt_Bytes;
     }
   }
   
   
          shmAttachmentsVO vo = new shmAttachmentsVO();
          vo.setAt_Bytes(fn_OpenAttachments(rs.getString("AT_NAME"), 
rs.getString("AT_NO"), asDocId));
   
        public byte[] fn_OpenAttachments(String asAttachName, String 
asAttachNo, S
   
   tring asDocId) {
   
                String strSlash = 
shmSessionManager.getInstance().getOSName().equals("WINDOWS") ? "//" : "/";
                File file = new 
File(shmSessionManager.getInstance().getAttachmentPath() + asDocId + strSlash +
                                asAttachNo + strSlash + asAttachName);
   
                byte[] byt = new byte[(int) file.length()];
   
                try {
                        FileInputStream fis = new FileInputStream(file);
                        fis.read(byt);
                        fis.close();
                }
                catch (IOException e) {
                        System.out.println("shmUtil.fn_OpenAttachments(): " + 
e.toString());
                }
                
                return byt;
        }
   
   
   
   Front End Code Royale
   
   remote Service Result Handler
        <fx:Script>
                <![CDATA[
   
                        private function fn_roAttachmentRH(e:ResultEvent):void 
{                                
                                acAttachment = e.result as ArrayCollection;
                                dgAttachment.dataProvider = acAttachment;
                                
                                acAttachment.refresh();
                                dgAttachment.validateNow();
                        }
                        protected function fn_SetupDownloadBtn(index:int):void {
                                btnDownload.defaultFileName = 
acAttachment[index].at_Name;
                                btnDownload.data = acAttachment[index].at_Bytes;
                        }
                ]]>
        </fx:Script>
   
   <mx:AdvancedDataGrid id="dgAttachment" designViewDataType="flat" 
styleName="advancedDataGrid"
                                                         sortExpertMode="false" 
horizontalScrollPolicy="auto" verticalAlign="middle" 
                                                         
dataProvider="{acAttachment}" editable="true" width="750" left="5" right="5"
                                                         top="5" bottom="30" 
allowMultipleSelection="true" 
                                                         
itemClick="fn_SetupDownloadBtn(dgAttachment.selectedIndex)">
                
                        <mx:columns>
                                <mx:AdvancedDataGridColumn dataField="at_No" 
headerText="S No."
                                                                                
   editable="false" width="60" visible="false"/>        
                                <mx:AdvancedDataGridColumn 
dataField="at_Seq_No" headerText="Seq"
                                                                                
   editable="false" width="60" />       
                                <mx:AdvancedDataGridColumn 
dataField="at_Doc_Id" headerText="docId"
                                                                                
   editable="false" width="60" visible="false"/>
                                <mx:AdvancedDataGridColumn dataField="at_Name" 
editable="false" 
                                                                                
   headerText="File Name" width="350"
                                                                                
   wordWrap="true" resizable="false">
                                </mx:AdvancedDataGridColumn>
                                
                                <mx:AdvancedDataGridColumn dataField="at_Bytes" 
headerText="file" editable="false"
                                                                                
   width="60" visible="false"/>
                        </mx:columns>
                </mx:AdvancedDataGrid>
   
   <mx:DownloadButton id="btnDownload" label="Download" left="487" bottom="5"/>
   
   
   
![ScreenShot(2)](https://user-images.githubusercontent.com/71439339/100702979-7ab1a080-33c4-11eb-95c8-fdf4dd92c647.png)
   
![ScreenShot(3)](https://user-images.githubusercontent.com/71439339/100702984-7c7b6400-33c4-11eb-8a5b-0b972fc857a0.png)
   
![ScreenShot(4)](https://user-images.githubusercontent.com/71439339/100702987-7dac9100-33c4-11eb-9eef-df28dd413cab.png)
   
![ScreenShot(5)](https://user-images.githubusercontent.com/71439339/100702988-7eddbe00-33c4-11eb-954f-a5d42e3bf1d6.png)
   
![ScreenShot(6)](https://user-images.githubusercontent.com/71439339/100702993-7f765480-33c4-11eb-81f7-463e70a58208.png)
   
   
   
   
   
        
   
![ScreenShot(1)](https://user-images.githubusercontent.com/71439339/100586686-58ab1600-3311-11eb-8c31-a39b3a47ed42.PNG)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to