Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by GF on Nov 27, 2008 10:28
open dhtmlx forum
grid - select/copy and changing mouse-over text

Hi,

I create a simple grid with the html below.

Two questions:-

1. The cells are read-only but I want to allow the user to select and copy a cell's value into the clipboard. Eg. select the cell content with the mouse and control-c or edit->copy to copy into the clipboard. How can I do this?

2. Can you give me some code to change the mouse-over text to be a different than the cell value. (I would like to have a different value for each cell.)


Thanks very much
GF


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>For demo purpose only :: &1</title>
<link rel='STYLESHEET' type='text/css' href='codebase/dhtmlxgrid.css'>
<script src='dhtmlxGrid/codebase/dhtmlxcommon.js'></script>
<script src='dhtmlxGrid/codebase/dhtmlxgrid.js'></script>
<script src='dhtmlxGrid/codebase/dhtmlxgridcell.js'></script>
</head>
<body>

<xml id="xmlDataIsland">
<rows>
<row id="1" attr="John">
<cell>-1500</cell>
<cell>A Time to Kill</cell>
<cell selected="true">John Grisham</cell>
<cell>12.99</cell>
<cell>1</cell>
<cell>24</cell>
<cell>0</cell>
<cell>05/01/1998</cell>
</row>
<row id="2" attr="Bob">
<cell>1000</cell>
<cell>Blood and Smoke</cell>
<cell>Stephen King</cell>
<cell>0</cell>
<cell>1</cell>
<cell>24</cell>
<cell>0</cell>
<cell>01/01/2000</cell>
</row>
</rows>
</xml>


<div id="gridbox" width="500px" height="250px" style="background-color:white;overflow:hidden"></div>
<script>
mygrid = new dhtmlXGridObject('gridbox');
mygrid.setImagePath('codebase/imgs/');
mygrid.setHeader("Column A, Column B, Column C");
mygrid.setInitWidths("100,250,100")
mygrid.setColTypes("ro,ro,ro");
mygrid.enableMultiselect(true)
mygrid.init();
mygrid.parse(document.getElementById("xmlDataIsland"));

</script>
</body>
</html>

Answer posted by Support on Nov 28, 2008 01:41
>>1. The cells are read-only but I want to allow the user to select and copy
By default native selection disabled in grid - please check
         http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=2186&ssr=yes&s=onselectstart

>>2. Can you give me some code to change the mouse-over text to be a different
a) you can define it directly in XML as
        <cell title="tooltip text her">cell text here</cell>