This is a migrated thread and some comments may be shown as answers.

copy rows after rows selected via checkbox

2 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roberto
Top achievements
Rank 1
Roberto asked on 31 Aug 2015, 09:16 AM

Hello, 

i have a grid with the column template with checkboxes, and chekbox to select all rows;

in the grid  i have enabled copy (.AllowCopy (true)), and it works if I select by clicking the ​rows and not the checkbox, however, if for example I select all lines using checkbox, the copy is not working.

I assumed might be a problem of focus, click on the checkboxes instead of rows, you lose the data to be copied, I have tried in the javascript selection function to shift the focus on the tbody of the grid, but this does not work ...

Any suggestions?

 Thanks, Roberto

2 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 02 Sep 2015, 08:26 AM
Hello Roberto,

Basically the desired behavior of updating the clipboard on clicking checkboxes in the toolbar of the Grid is not supported and would require custom code. For your convenience I created small example which shows possible solution - you can use it as baseline to achieve the desired behavior:

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Roberto
Top achievements
Rank 1
answered on 04 Sep 2015, 09:52 AM

Thanks for your help, the example has helped me, the trick is to use this piece of code :

if (checked) {
            if (!grid.areaClipBoard) {
                grid.areaClipBoard =
                    $("<textarea />")
                    .css({
                        position: "fixed",
                        top: "50%",
                        left: "50%",
                        opacity: 0,
                        width: 0,
                        height: 0
                    })
                    .appendTo(grid.wrapper);
            }

            grid.areaClipBoard.val(grid.getTSV()).focus().select();
        }

 

Regards,

Roberto​

Tags
Grid
Asked by
Roberto
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Roberto
Top achievements
Rank 1
Share this question
or