Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
jwoodall01
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Copy table to clipboard

Does anyone know how to set up a link/button that would copy a table to the clipboard?  For example, if I was displaying multiple tables and each table had information for a different state... how could I put a link at the bottom of each table that would copy it to the clipboard?
Please use plain text.
Administrator
MSohm
Posts: 14,429
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Copy table to clipboard

This is not possible from within the BlackBerry Browser.  It could be done in a Java application by creating a Java Object to hold your table, which is then passed into the Clipboard.put method.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Guru I
Xandrex
Posts: 18,382
Registered: ‎07-29-2008
My Device: Z10 10.1.0.2312 / Playbook 2.1 / 8900 5.0
My Carrier: Vodafone France (SFR) & B&You

Re: Copy table to clipboard

can you provide an example of such a table and what you want copied in your clipboard ?
you may be able to tweak something in html with a fake href attribute.



The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Please use plain text.
New Developer
jwoodall01
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Copy table to clipboard

Just any html table really... for example

 

<table>

<tr>

  <td>A</td>

  <td>B</td>

  <td>C</td>

</tr>

</table>

Please use plain text.
Guru I
Xandrex
Posts: 18,382
Registered: ‎07-29-2008
My Device: Z10 10.1.0.2312 / Playbook 2.1 / 8900 5.0
My Carrier: Vodafone France (SFR) & B&You

Re: Copy table to clipboard

It depends where you want to paste the data...
I'd try and use the "Link adress" (shortcut is L in the Blackberry Browser) :

<html><body>

<div id="myTable1" style="border: red solid 1px;">
<table summary="data1" border="1">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
<a href="http://mmf?A;B;C$1;2;3$">"data1" content (L)</a>
</div>

</body></html>

 then when you paste, you'll get a string containing this :

 

http://mmf/?A;B;C$1;2;3$

 

and stripping the beggining is easy to get :

 

"A;B;C$1;2;3$"

 

 

 




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Please use plain text.
New Developer
jwoodall01
Posts: 22
Registered: ‎07-14-2008
My Device: Not Specified

Re: Copy table to clipboard

Since you had to put A,B,C,1,2,3 into the href, there would be no way to do it with dynamic data though... correct?

Please use plain text.
Guru I
Xandrex
Posts: 18,382
Registered: ‎07-29-2008
My Device: Z10 10.1.0.2312 / Playbook 2.1 / 8900 5.0
My Carrier: Vodafone France (SFR) & B&You

Re: Copy table to clipboard


jwoodall01 wrote:

Since you had to put A,B,C,1,2,3 into the href, there would be no way to do it with dynamic data though... correct?


It depends on what you mean by "dynamic"...

 

You can of course create a php script that will deliver static HTML (that's for the easy part :smileyhappy: ).

 

You can maybe do some basic javascript that will create the href dynamically (don't dream of DOM though, I'm pretty sure the Blackberry javascript support is not very high)

 

  document.write() is supported as of march 2007, so if you have a javascript array somewhere... it's quite easy.

http://na.blackberry.com/eng/developers/resources/journals/mar_2007/bdjs.jsp

 

 

ah HA ! I'm reading right now that with HH OS 4.6 you will be able to do AJAX, toy with XML and DOM2, please read KB15466 :

http://www.blackberry.com/btsc/search.do?cmd=displayKC&docType=kc&externalId=KB15466&sliceId=SAL_Pub...

 

 

but I'm still wondering if dynamic is really mandatory ? Moreover 4.6 is very far away for non-Bold handhelds.




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Please use plain text.