Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

MVC Grid - Get values from other pages?

$
0
0

I found a solution to my problem.The goal was to be able to get a complete list of all records that might be in the grid. A 'select all' without actually having all the items in the grid. What was key is to be able to apply all the same filters, sorts and groups to the data that are currently applied to the grid. Also it was very important that we maintain the current status of the grid. The example code below provides the functionality required.

        var grid = $("#mygrid").data("kendoGrid");

        var parameterMap = grid.dataSource.transport.parameterMap;
        var data = parameterMap({ sort: grid.dataSource.sort(), filter: grid.dataSource.filter(), group: grid.dataSource.group() });
        var extraParams = { sort: data.sort, filter: data.filter, group: data.group, varX: x, varY: y, varZ: z};

        $.ajax({
            url: _relativePath + "/MyController/MyMethod", //Same controller and method called by the grid definition.
            data: extraParams,
            type: "POST",
            dataType: "json",
            async: false,
            success: function(result) {
                alert('Success!');
            },
            error: function (e) {
            }
        });

Thanks.


Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>