You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/06/15 10:00:05 UTC

[GitHub] [royale-asjs] pashminakazi opened a new issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

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


   Project Details are :
   https://paste.apache.org/cpo8y
   Test case is available on VDI.
   Go to Accounts Recieveable from Select in Menu
   Go to Sales Commission Scheme Setup from Setups in Menu
   File : com/dbz/modules/AR/dbzSalesCommissionScheme.mxml
   
   Click on New Button then Plus (+) button,Popup will be opened and then click Plus (+) Buttonn and then attachment icon,attach any files
   
   Whole row should be highlighted when we select a row.File Name is not highlighted in Royale
   ![image](https://user-images.githubusercontent.com/42200979/84643207-ef784780-af16-11ea-9879-89f9a84d105d.png)
   
   and when we click on File Name the popup should be opened to save this File
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648274128


   Hi Alex,
   
   I dont know how to prepare data before click and how to create a popup.I
   didn't understand the discussion in #838.
   
   On Tue, Jun 23, 2020, 9:08 PM aharui <no...@github.com> wrote:
   
   > The key difference is that in Royale, the data and defaultFileName must be
   > set before the button is clicked. It cannot be setup in a click handler.
   > Look at the example in #838
   > <https://github.com/apache/royale-asjs/issues/838> more carefully. If you
   > don't have the data ready early enough, you may need to use a popup to give
   > you a chance to prepare the data.
   >
   > —
   > You are receiving this because you authored the thread.
   > Reply to this email directly, view it on GitHub
   > <https://github.com/apache/royale-asjs/issues/867#issuecomment-648262960>,
   > or unsubscribe
   > <https://github.com/notifications/unsubscribe-auth/AKB67E7PJHVQZ4J6BGSGIVDRYDHRRANCNFSM4N6AN2UQ>
   > .
   >
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-645305379


   @aharui 
   I have replaced **mx:LinkButton** with
   ```
   <mx:DownloadButton styleName="htmlLink" id="downloadButton"  
   label="{data.at_Name}"
   toolTip="Save File" 
   click="btnDownload_clickHandler(data.at_Name,data.at_Bytes,data.at_Status)"/>
   ```
   ```
   private function btnDownload_clickHandler(name:String,file:mx.utils.ByteArray,status:String):void {						
   	if(status!= "0") {
               downloadButton.defaultFileName = name;			            									 
   	}
          else
   	    Alert.show("File has been Removed.");
   	}
   ```
   ![image](https://user-images.githubusercontent.com/42200979/84889950-24b99c80-b0b3-11ea-9825-7e790f2722b7.png)
   
   but it doesn't download the file
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-645151591


   I don't understand your last comment.  Maybe open a new issue about it.d


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-645779952


   Run the test app in #838 to see if that works for you.  Also read the discussion in #838.  DownloadButton requires a slightly different workflow than FileReference.save.  The information needs to be ready before the button is clicked.  You may need a popup instead.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui edited a comment on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui edited a comment on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-645151591


   I don't understand your last comment.  Maybe open a new issue about it.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-644569622


   You will have to use the DownloadButton as described in #838


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-650275016


   As in the example in #838, you should no longer need a click handler.
   
   I don't know when your application should set the DownloadButton.data.  It all depends on when you know what that data is.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-650060008


   mx:DownloadButton and clickhandler function is inside these tags
   <mx:itemRenderer>
   		<fx:Component>
   			<s:MXAdvancedDataGridItemRenderer height="22" >
   				<fx:Script>
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648274841


   Which things should i use?
   XMLList and json part is necessary for my attachment popup or not?
   
   On Tue, Jun 23, 2020, 9:28 PM Pashmina Kazi <pa...@gmail.com> wrote:
   
   > Hi Alex,
   >
   > I dont know how to prepare data before click and how to create a popup.I
   > didn't understand the discussion in #838.
   >
   > On Tue, Jun 23, 2020, 9:08 PM aharui <no...@github.com> wrote:
   >
   >> The key difference is that in Royale, the data and defaultFileName must
   >> be set before the button is clicked. It cannot be setup in a click handler.
   >> Look at the example in #838
   >> <https://github.com/apache/royale-asjs/issues/838> more carefully. If
   >> you don't have the data ready early enough, you may need to use a popup to
   >> give you a chance to prepare the data.
   >>
   >> —
   >> You are receiving this because you authored the thread.
   >> Reply to this email directly, view it on GitHub
   >> <https://github.com/apache/royale-asjs/issues/867#issuecomment-648262960>,
   >> or unsubscribe
   >> <https://github.com/notifications/unsubscribe-auth/AKB67E7PJHVQZ4J6BGSGIVDRYDHRRANCNFSM4N6AN2UQ>
   >> .
   >>
   >
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648262960


   The key difference is that in Royale, the data and defaultFileName must be set before the button is clicked.  It cannot be setup in a click handler.  Look at the example in #838 more carefully.  If you don't have the data ready early enough, you may need to use a popup to give you a chance to prepare the data.


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-644962514


   @aharui ok thanks
   But another issue is : when i click on row of attached file the row will be highlighted without the file name, filename should be highlighted as well as it is included in that row


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi edited a comment on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi edited a comment on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648031009


   @aharui 
   **I have replaced** 
   **<mx:LinkButton styleName="htmlLink"  label="{data.at_Name}" toolTip="Save File"												   
     click="btnDownload_clickHandler(data.at_Name,data.at_Bytes,data.at_Status)"/>**
   
   ```
   private function btnDownload_clickHandler(name:String,file:mx.utils.ByteArray,status:String):void {
           if(status!= "0") {
               frd = new mx.net.FileReference();										
               frd.addEventListener(org.apache.royale.events.Event.OPEN, openHandler);	
               frd.save(file,name);
               }
              else
   	       Alert.show("File has been Removed.");
   	    }
   ```
   
   
   **With**
   ```
   <mx:DownloadButton styleName="htmlLink" id="downloadButton"  label="{data.at_Name}"
    toolTip="Save File"											   
    click="btnDownload_clickHandler(data.at_Name,data.at_Bytes,data.at_Status)"/>
   ```
   
   ```
   private function btnDownload_clickHandler(name:String,file:mx.utils.ByteArray,status:String):void {						
   	if(status!= "0") {
              downloadButton.defaultFileName = name;	
              downloadButton.data = menuDataXMLList.toString()										 
           }
          else
   	   Alert.show("File has been Removed.");
   	}
   
   <fx:Declarations>
   	  <fx:XMLList id="menuDataXMLList">
   		<menuitem label="label-1">			
   			<menuitem label="label-1-1"/>			
   			<menuitem label="label-1-2"/>			
   		</menuitem>
   		<menuitem label="Switch Locale" id="admin" >			
   			  <menuitem label="label-2-1"/>			
   			  <menuitem label="label-2-2"/>			
   			  <menuitem label="label-2-3" id="admin" />
   		</menuitem>
   	      </fx:XMLList>
   	    </fx:Declarations>
   ```
   
   
   if i remove   **downloadButton.data = menuDataXMLList.toString()** then file Name is shown
   if i added  **downloadButton.data = menuDataXMLList.toString()** file Name doesn't visible,in both situation file download doesn't work.
   
   As discussed in (https://github.com/apache/royale-asjs/issues/838) I have added
   ```
   COMPILE::JS {
     var saveData = (function () {
   	var a = document.createElement("a");
   	document.body.appendChild(a);
   	a.style = "display: none";
   	return function (data, fileName) {
   	var json = JSON.stringify(data),
   	blob = new Blob([json], {type: "octet/stream"}),
   	url = window.URL.createObjectURL(blob);
   	a.href = url;
          a.download = fileName;
          a.click();
          window.URL.revokeObjectURL(url);
         };
   }());
   var data = { x: 42, s: "hello, world", d: new Date() },
   fileName = name;
   saveData(data, fileName);
   } 
   ```
   
   But after this there's a compilation Error 
   Implicit type coercion of blob from Object to etc
   Access of possibly undefined URL with reference window
   So i commented this part.
   
   I am trying to fix this issue from last 2 to 3 days with multiple changes,nothing works for me,
   I you have time then please write a correct code for me,or instruct me to write code
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] aharui commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
aharui commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648293079


   In #838, the data was XML.  Is your data XML?  It looks like it is a regular ByteArray.  The data.at_Bytes ByteArray would be assigned to the DownloadButton.data, and the DownloadButton.defaultFileName would be assigned data.at_Name.
   
   In Flex, the LinkButton would be created at startup, and later the user would click on it, and the data.at_Bytes could have changed between startup and the click based on other things the user did, including other code that could run when the user clicked on the LinkButton.
   
   In Royale, the DownloadButton is created at startup and the data and defaultFileName must be set before the DownloadButton sees the click event so it is harder to deal with changes to the ByteArray based on what the user did after startup.
   
   I don't know when your code has made the ByteArray ready, but that is the point at which it need to be assigned  to the DownloadButton's data property.  It can't be done in the DownloadButton's clickHandler


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-650059079


   Ok,If I will create a separate function for preparing data before calling click handler
   Example In that function I will do
   private function PreparingData(name:String,file:mx.utils.ByteArray,status:String):void {						
   	DownloadButton.data = data.at_Bytes;
           DownloadButton.defaultFileName = data.at_Name;									
   }
   
   where i call PreparingData function? and then when i am doing everything in that function,what should i do in ClickHandler function?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [royale-asjs] pashminakazi commented on issue #867: Attachment should be saved when Click on attachment file Popup Should be opened

Posted by GitBox <gi...@apache.org>.
pashminakazi commented on issue #867:
URL: https://github.com/apache/royale-asjs/issues/867#issuecomment-648031009


   @aharui 
   **I have replaced** 
   **<mx:LinkButton styleName="htmlLink"  label="{data.at_Name}" toolTip="Save File"												   
     click="btnDownload_clickHandler(data.at_Name,data.at_Bytes,data.at_Status)"/>**
   
   ```
   private function btnDownload_clickHandler(name:String,file:mx.utils.ByteArray,status:String):void {
           if(status!= "0") {
               frd = new mx.net.FileReference();										
               frd.addEventListener(org.apache.royale.events.Event.OPEN, openHandler);	
               frd.save(file,name);
               }
              else
   	       Alert.show("File has been Removed.");
   	    }
   ```
   
   
   **With**
   ```
   <mx:DownloadButton styleName="htmlLink" id="downloadButton"  label="{data.at_Name}"
    toolTip="Save File"											   
    click="btnDownload_clickHandler(data.at_Name,data.at_Bytes,data.at_Status)"/>
   ```
   
   ```
   private function btnDownload_clickHandler(name:String,file:mx.utils.ByteArray,status:String):void {						
   	if(status!= "0") {
              downloadButton.defaultFileName = name;	
              downloadButton.data = menuDataXMLList.toString()										 
           }
          else
   	   Alert.show("File has been Removed.");
   	}
   ```
   
   	```
   <fx:Declarations>
   	  <fx:XMLList id="menuDataXMLList">
   		<menuitem label="label-1">			
   			<menuitem label="label-1-1"/>			
   			<menuitem label="label-1-2"/>			
   		</menuitem>
   		<menuitem label="Switch Locale" id="admin" >			
   			  <menuitem label="label-2-1"/>			
   			  <menuitem label="label-2-2"/>			
   			  <menuitem label="label-2-3" id="admin" />
   		</menuitem>
   	      </fx:XMLList>
   	    </fx:Declarations>
   ```
   
   
   if i remove   **downloadButton.data = menuDataXMLList.toString()** then file Name is shown
   if i added  **downloadButton.data = menuDataXMLList.toString()** file Name doesn't visible,in both situation file download doesn't work.
   
   As discussed in (https://github.com/apache/royale-asjs/issues/838) I have added
   ```
   COMPILE::JS {
     var saveData = (function () {
   	var a = document.createElement("a");
   	document.body.appendChild(a);
   	a.style = "display: none";
   	return function (data, fileName) {
   	var json = JSON.stringify(data),
   	blob = new Blob([json], {type: "octet/stream"}),
   	url = window.URL.createObjectURL(blob);
   	a.href = url;
          a.download = fileName;
          a.click();
          window.URL.revokeObjectURL(url);
         };
   }());
   var data = { x: 42, s: "hello, world", d: new Date() },
   fileName = name;
   saveData(data, fileName);
   } 
   ```
   
   But after this there's a compilation Error 
   Implicit type coercion of blob from Object to etc
   Access of possibly undefined URL with reference window
   So i commented this part.
   
   I am trying to fix this issue from last 2 to 3 days with multiple changes,nothing works for me,
   I you have time then please write a correct code for me,or instruct me to write code
   


----------------------------------------------------------------
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:
users@infra.apache.org