copy rows after rows selected via checkbox

3 posts, 0 answers
  1. Roberto
    Roberto avatar
    8 posts
    Member since:
    Mar 2015

    Posted 31 Aug 2015 Link to this post

    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. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2194 posts

    Posted 02 Sep 2015 Link to this post

    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
  3. Roberto
    Roberto avatar
    8 posts
    Member since:
    Mar 2015

    Posted 04 Sep 2015 Link to this post

    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​

Back to Top