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"/>






----------------------------------------------------------------
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]