Sabareesh
Sabareesh

Reputation: 1

How to copy contents to clipboard from a kendo grid?

I would like to copy the contents of a kendo grid. The grid has multiselect and row select options. I could neither select the cell content text nor copy the cell content. I could not get a proper answer from other stack overflow questions and hence asking this as separate question.

Upvotes: 0

Views: 5439

Answers (2)

Wenyue Zheng
Wenyue Zheng

Reputation: 1

<ClientSettings>
      <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="3"></Scrolling>
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="False"></Selecting>
</ClientSettings>

Set EnableDragToSelectRows="False" in Telerik gird <ClientSettings>:

<ClientSettings>
      <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="true" FrozenColumnsCount="3"></Scrolling>
                        <Selecting AllowRowSelect="True" EnableDragToSelectRows="False"></Selecting>
</ClientSettings>

Upvotes: 0

ShawnOrr
ShawnOrr

Reputation: 1329

Make sure you have the allowCopy property set to True in your grid. Click Here for documentation.

If set to true and selection of the Grid is enabled the user could copy the selection into the clipboard and paste it into Excel or other similar programs that understand TSV/CSV formats. By default allowCopy is disabled and the default format is TSV. Can be set to a JavaScript object which represents the allowCopy configuration.

<div id="grid"></div>
<script>
$("#grid").kendoGrid({
    selectable: "multiple cell",
    allowCopy: true,
    columns: [
        { field: "productName" },
        { field: "category" }
    ],
    dataSource: [
        { productName: "Tea", category: "Beverages" },
        { productName: "Coffee", category: "Beverages" },
        { productName: "Ham", category: "Food" },
        { productName: "Bread", category: "Food" }
    ]
});
</script>

Here is a working example you can test with.

Upvotes: 0

Related Questions