@Html.EJS().DropDownList("EventsDropDown").Placeholder("Seleccione un evento").Select("EventsDropDownClick").PopupHeight("200px").DataSource(dataManger => dataManger.Url(Url.Action("GetEvents", "Participants", new { Area = "Events" })).Adaptor("ODataV4Adaptor").CrossDomain(true)).Fields(new Syncfusion.EJ2.DropDowns.DropDownListFieldSettings { Text = "Name", Value = "Id" }).Render() @Html.EJS().Grid("ParticipantsGrid").ActionBegin("begin").AllowFiltering().AllowExcelExport(true).AllowPdfExport(true).ShowColumnChooser(true).ToolbarClick("toolbarClick").DataSource(dataManager => { dataManager.Url(Url.Action("GetParticipants", "Participants", new { Area = "Events" })).RemoveUrl("").UpdateUrl("").CrossDomain(true).Adaptor("WebApiAdaptor"); }).Columns(col => { col.Field("Id").HeaderText("ID").IsPrimaryKey(true).Width("120").Add(); col.Field("Identity").HeaderText("Número").Width("150").Add(); col.Field("AttendeeName").HeaderText("Nombres").Width("150").Add(); col.Field("AttendeeLastName").HeaderText("Apellidos").Width("150").Add(); col.Field("TypeParticipant").AllowEditing(false).HeaderText("Tipo").Width("150").Add(); col.Field("AttendeePosition").HeaderText("Cargo").Width("150").Add(); col.Field("AttendeeFaculty").HeaderText("Facultad").Width("150").Add(); col.Field("PaymentType").AllowEditing(false).HeaderText("Método de pago").Width("150").Add(); col.Field("Amount").HeaderText("Monto").Format("C2").Width("150").Add(); }).AllowPaging().AllowSorting().AllowGrouping().AllowReordering().AllowResizing().EditSettings(edit => { edit.AllowDeleting(true).AllowEditing(true).Mode(Syncfusion.EJ2.Grids.EditMode.Dialog).ShowDeleteConfirmDialog(true); }).FilterSettings(filter => { filter.Type(Syncfusion.EJ2.Grids.FilterType.Excel); }).Locale("es").PageSettings(page => page.PageSize(20).PageSizes(true)).Toolbar(new List |
function EventsDropDownClick(args) { var grid = document.getElementById("ParticipantsGrid").ej2_instances[0]; grid.refresh(); }; function toolbarClick(args) { var gridObj = document.getElementById("ParticipantsGrid").ej2_instances[0]; if (args.item.id === 'ParticipantsGrid_pdfexport') { gridObj.pdfExport(); } if (args.item.id === 'ParticipantsGrid_excelexport') { gridObj.excelExport(); } } function begin(args) { var value = document.getElementById('EventsDropDown').ej2_instances[0].itemData.Id || 0; if (value != 0) { value = value.toString(); } this.properties.query = new ej.data.Query().addParams('eventId', value) } |
[HttpGet] [AllowAnonymous] //[ValidateJsonAntiForgeryToken] public ActionResult GetParticipants() { if (string.IsNullOrEmpty(Request.QueryString["eventId"])) return Json(new { success = true, Items = new { }, Count = 0 }, JsonRequestBehavior.AllowGet); int eventId = Convert.ToInt32(Request.QueryString["eventId"]); using (var client = new HttpClient()) { client.BaseAddress = new Uri(_baseUrl); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var res = client.GetAsync($"Management/Participants/GetParticipants/{eventId}").Result; if (!res.IsSuccessStatusCode) return Json(new { success = false }, JsonRequestBehavior.AllowGet); var empResponse = res.Content.ReadAsStringAsync().Result; var participants = JsonConvert.DeserializeObject return Json(new { success = true, Items = participants, Count = participants.Count() }, JsonRequestBehavior.AllowGet); } } |
function EventsDropDownClick(args) { $.ajax({ url: window.getPart, data: { eventId: args.itemData.Id }, type: "GET", async: true, success: function (result) { var grid = document.getElementById("ParticipantsGrid").ej2_instances[0]; grid.dataSource = result.data; }, error: function (result) { alert(result); } }); }; |
function EventsDropDownClick(args) {
var grid = document.getElementById("ParticipantsGrid").ej2_instances[0]; grid.filterByColumn("CustomerID", "equal", dropdownselectedVlaue); }; |