Hello,
my grid reload data after applying a custom filter so when i have 2000 lines to retrieved, the grid show it correctly but when i passed 9000 line in the result i have 500 error and the grid doesn't refresh. this my ajax call:
thanks for your helping.
Best regards.
@(Html.Kendo().Grid<DigitConvForm.Web.Models.DossierViewModel>()
.Name("Dossiers")
.Columns(columns =>
{
columns.Bound(c => c.Id_Inscription );
columns.Bound("Nom").ClientTemplate("#=Civilite# #=Nom# #=Prenom#");
columns.Bound(c => c.Libelle );
columns.Bound(c => c.DateDebut ).Format("{0:dd/MM/yyyy}");
columns.Bound(c => c.DateFin ).Format("{0:dd/MM/yyyy}");
columns.Bound(c => c.CDV ).ClientTemplate("<span id = 'badge_#=CDV#' class='badgeTemplate'></span>").Width(80);
columns.Bound(c => c.LibelleEntreprise );
columns.Bound(c => c.Code_Financement );
columns.Bound(c => c.CodeDepartement );
columns.Bound(c => c.ContactEcole );
columns.Bound(c => c.Gestionnaire);
columns.Bound(c => c.GestDosAdmin );
columns.Bound(c => c.StatutDosAdmin );
})
.ToolBar(toolbar =>
{
toolbar.Excel();
toolbar.Pdf();
toolbar.Search();
}).Excel(excel => excel.AllPages(true))
.Height(700)
.Pageable(pageable => pageable
.Input(true)
.Numeric(false)
)
.Navigatable().Mobile()
.Sortable()
.Scrollable()
.Resizable(r => r.Columns(true))
.Reorderable(r => r.Columns(true))
//.Filterable()
.Events(e => e.DataBound("onDataBound"))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(false)
.PageSize(500)
.AutoSync(false)
.ServerOperation(true)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(p => p.Id_Inscription);
model.Field(p => p.Civilite ).Editable(false);
model.Field(p => p.Nom ).Editable(false);
model.Field(p => p.Prenom ).Editable(false);
model.Field(p => p.Libelle ).Editable(false);
model.Field(p => p.DateDebut ).Editable(false);
model.Field(p => p.DateFin ).Editable(false);
model.Field(p => p.LibelleEntreprise).Editable(false);
model.Field(p => p.Code_Financement ).Editable(false);
model.Field(p => p.CodeDepartement ).Editable(false);
model.Field(p => p.ContactEcole ).Editable(false);
model.Field(p => p.GestDosAdmin ).Editable(false);
model.Field(p => p.StatutDosAdmin ).Editable(false);
model.Field(p => p.Gestionnaire ).Editable(false);
})
.Read("GetAllFolders", "RechercheDossiers")
$.ajax({
url: '@Url.Action("GetFiltredFolders", "RechercheDossiers")',
type: "Post",
data: { nom, prenom, dateDebut: dateD, dateFin: dateF, sAnticipee, pFormations, financements, gestionnaires },
traditional: true,
dataType: 'json',
async: true,
success: function (result) {
searchResults = result;
},
error: function (xhr, ajaxOptions, thrownError) {
alert('failed')
},
timeout: 30000,
cache: false
}).done(function () {
var dataSource = new kendo.data.DataSource({ data: searchResults });
var grid = $('#Dossiers').data("kendoGrid");
dataSource.read().then(function () {
$('#Dossiers').data('kendoGrid').refresh();
});
var pageSi = grid.dataSource._pageSize
grid.setDataSource(dataSource);
grid.dataSource.query({ page: 1, pageSize: pageSi });
//grid.refresh();
});
[HttpPost]
public async Task<JsonResult> GetFiltredFolders(DateTime? dateDebut, DateTime? dateFin,
bool sAnticipee, string nom, string prenom, string financements, string pFormations, string gestionnaires)
{
string departments = Session["department"].ToString();
List<Dossier> dossiers = await _conventionDeFormationService.LoadFoldersByAccess(departments, dateDebut, dateFin,
sAnticipee, nom, prenom, financements, pFormations, gestionnaires);
return Json(dossiers, JsonRequestBehavior.AllowGet);
}