Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Darren Bowen on May 23, 2007 12:15
open dhtmlx forum
Copying Select/Combo ExCells - How To Copy Option Name instead of Value?

I have enabled copying and pasting on our data-grid but when a cell is selected that contains a combo or select cell (co/coro) then the data that is placed on the clipboard corresponds to the value of that cell rather than the text that is displayed. This makes sense if the data is to be pasted back into the grid, but it would be useful if there there was a way to instruct the grid to copy the option name of cells instead of the value, so that the data can be pasted in human readable form.

Example we have a column with employee names, with the following options
<option value="1">Fred Blogs</option>
<option value="2">John Doe</option>

Copying a cell which is set to 'Fred Blogs' actually copies '1' to clipboard, I'd like to be able to copy 'Fred Blogs' instead.
Answer posted on May 23, 2007 18:59
This seems as usefull feature, but unfortunately it is not supported in current version (1.3) and there is no easy way to achieve such functionality without breaking other.
I added this request in ToDo list, so it will be added in next version.

If you not use serialization functionality for other purposes, you can update the code of dhtmlxGrid_nxml.js in next manner
locate
     zxVal=zx[this._agetm]();
and replace it with
     zxVal=zx.getLabel();

as result data will be put in clipboard as it shown in grid


Answer posted on May 24, 2007 11:34
I'd also like to see this in the printer friendly view as well (which displays the value instead of the cell text). Ideally I think that excells ought to have a method along the lines of getPrintFriendlyText() so that each cell type can be handled individually. For example the advanced checkbox could print "yes" or "no" without the coloured square. In some of my grids I also have an image which displays a percentage as a mini pie chart, it'd be excellent if I could make this into an excell which had the getPrintFriendlyText() method and displayed text such as "25%" instead of the image of a pie chart.
Answer posted on May 24, 2007 16:40
Basically each exCell already has two methods

getValue - return exact value
getLabel - return formatted value

Currently getLabel used mainly in treeGrid and not used in other parts of grid, it looks as a good idea to use it in printFriendlyView and optionally in clipboard operation ( getLabel can be redefined to return value in any format without breaking other functionality of grid. )
Next version of grid will definitely have an improvment in this direction.
Answer posted by Alexandra (Support) on Dec 07, 2014 08:40

The information connected with javascript upload and html autocomplete also can help you, so please check it too.