BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
$("#Grid").ejGrid({ . . . . allowFiltering: true, filterSettings: { filterType: "excel" }, . . . . . . actionBegin: function (args) { if (args.requestType == "filterchoicerequest") args.query.select(args.filterModel.fName); } |
$("#Grid").ejGrid({ . . . . allowFiltering: true, filterSettings: { filterType: "excel" }, . . . . . actionBegin: function (args) { if (args.requestType == "filterchoicerequest") args.query.addParams("field",args.filterModel.fName);
} |
[cshtml] @(Html.EJ().Grid<object>("Grid") .Datasource(ds => ds.URL(@Url.Action("DataSource")).Adaptor(AdaptorType.UrlAdaptor)) . . . . .ClientSideEvents(evt => evt.Load("OnLoad")) [script] function OnLoad(args) { //Now the dataSource will be included with grid model on export this.ignoreOnExport.splice(this.ignoreOnExport.indexOf("dataSource"), 1); } |
<script> ej.DataManager.prototype.toJSON = function () {
//Getting the grid model. var model = $("#Grid").ejGrid("model");
/* Using `processQuery` method of the corresponding adaptor is used to create data object suitable to send to server. * So now the req.data will contains object that can be bound directly with `DataManager` class */ var req = this.adaptor.processQuery(model.dataSource, model.query, false);
return JSON.parse(req["data"]);
};
|
public DataManager GridDataManager { get; set; } //Action to export to excel [HttpPost] public void ExcelExport(string GridModel) { GridProperties gridProperty = ConvertGridObject(GridModel);
ExcelExport exp = new ExcelExport();
//Get IEnumerable result by processing DataManager. IEnumerable result = GetDataSource(GridDataManager).result; exp.Export(gridProperty, result, "Export.xlsx", ExcelVersion.Excel2010, false, false, "flat-saffron");
private GridProperties ConvertGridObject(string gridProperty) { . . . .. GridProperties gridProp = new GridProperties(); foreach (KeyValuePair<string, object> ds in div) { var property = gridProp.GetType().GetProperty(ds.Key, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase); //Check for `dataSource` if (ds.Key == "dataSource") { //Deserialize the value to DataManager type. GridDataManager = (DataManager)serializer.Deserialize(serializer.Serialize(ds.Value), typeof(DataManager)); continue; } . . . . . . } return gridProp; //Process DataManager with the order list and return result, count pair private DTO GetDataSource(DataManager dm) {
IEnumerable Data = order; int count = order.Count; Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting { Data = operation.PerformSorting(Data, dm.Sorted); } . . . . . . . . return new DTO { result = Data, count = count }; |
[cshtml] @(Html.EJ().Grid<object>("Grid") .Datasource(ds => ds.URL(@Url.Action("DataSource")).Adaptor(AdaptorType.UrlAdaptor)) . . . . .ClientSideEvents(evt => evt.ToolBarClick("OnToolbarclick")) function OnToolbarclick(args) {
this.model["myData"] = "..."
|
. . . . . .
<script type="text/javascript">
. . . . . . .
$('#Grid').on('focusout', function(args){ // triggred when focus is out of grid. Use your grid id here
$("#args.relatedTarget.id").ejDialog('close') // close the filter dialog
});
});
</script>
|