@(Html.EJ().Grid<SampleDemo1.OrdersView>("FlatGrid") col.HeaderText("Unbound Button").Commands(command => .ButtonOptions(new Syncfusion.JavaScript.Models.ButtonProperties() Click = "onClick" }).Add(); .IsUnbound(true) .TextAlign(TextAlign.Center) .Width(150) .Add();
}) ) <script type="text/javascript"> function onClick(args) { var gridObj = $("#FlatGrid").data("ejGrid"); //getting corresponding record var data = gridObj.getSelectedRecords()[0].OrderID; $.ajax({ type: "POST", url: "/Grid/Query", //Sending data to the server(controller) side data: { "data": data } });
} public class GridController : Controller { public void Query(int? data) { //getting data from the client side
Console.WriteLine(data); } |
<div id="Grid" ej-grid e-datasource="data" > <div e-columns> . . . . <div e-column e-headertext="Details" e-commands="command" e-isunbound=true e-textalign="center" e-width="150"></div> </div> </div>
angular.module('listCtrl', ['ejangular']) .controller('PhoneListCtrl', function ($scope) { $scope.data = obj; $scope.toolbar = ["add", "edit", "delete", "update", "cancel"]; $scope.onClick = function (args) { var gridObj = $("#Grid").data("ejGrid"); //getting corresponding record EmployeeID value var data = gridObj.getSelectedRecords()[0].EmployeeID; alert(data);
} $scope.command = [{ type: "details", buttonOptions: { text: "Details", width: "100", click: $scope.onClick, } }];;
|