Can't find what you're looking for?

Contact us or post in our forums and we'll help you find an answer.

Update Pasted Rows on a FlexGrid Connected to a Database Server when the Grouping Property is Enabled

Background:

Clipboard operations are very common and useful when copying information from one place and pasting to another place. On pasting the data to a FlexGrid, it updates the rows locally but we still need to update the rows explicitly on the server.

To update the recently pasted rows on the server, we need to get the pasted rows using the pasted event of the FlexGrid and then iterate each row for the pasted row range.

If grouping is enabled, we need to add a condition that excludes group rows and then get the correct pasted data when we pass the update to the server.

The following code snippet would be used to find out the correct pasted rows:

function pasted(s, e){
        var items = [];
        var row = e.range.row;
        var temp=e.range.row;
        var totalCount = e.range.rowSpan;
        while (row < totalCount) {
        //avoid group row
            if (!(s.rows[temp] instanceof wijmo.grid.GroupRow)) {
                items.push(s.rows[temp].dataItem);
                row++;
            }
            temp++;
        }
        // ajax call to update on server
        updateOnServer(items);
    }

Get the Latest Version of ASP.NET MVC, ASP.NET MVC Core, Wijmo
Download the Free Trial Now