You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DtParameters dtParameters can't initilize and getting ajaxy error in data loading.
Draw = 0,
search = null
column = null
length = null
[HttpPost]
public async Task LoadTable(DtParameters dtParameters, int districtid, int schoolid)
{
schoolid = 1;
var searchBy = dtParameters.Search?.Value;
// if we have an empty search then just order the results by Id ascending
var orderCriteria = "Id";
var orderAscendingDirection = true;
if (dtParameters.Order != null)
{
// in this example we just default sort on the 1st column
orderCriteria = dtParameters.Columns[dtParameters.Order[0].Column].Data;
orderAscendingDirection = dtParameters.Order[0].Dir.ToString().ToLower() == "asc";
}
//Direct table list into Grid
using (var Context = new SchooldexAOIContext())
{
var GridData = _context.UserSetupInfos.AsQueryable();
if (!string.IsNullOrEmpty(searchBy))
{
GridData = GridData.Where(r => r.FirstName != null && r.FirstName.ToUpper().Contains(searchBy.ToUpper()) ||
r.LastName != null && r.LastName.ToUpper().Contains(searchBy.ToUpper()) ||
r.Email != null && r.Email.ToUpper().Contains(searchBy.ToUpper()));
}
GridData = orderAscendingDirection ? GridData.OrderByDynamic(orderCriteria, DtOrderDir.Asc) : GridData.OrderByDynamic(orderCriteria, DtOrderDir.Desc);
// now just get the count of items (without the skip and take) - eg how many could be returned with filtering
var filteredResultsCount = await GridData.CountAsync();
var totalResultsCount = await _context.UserSetupInfos.CountAsync();
return Json(new DtResult<SchooldexAPI_DB.Contexts.UserSetupInfo>
{
Draw = dtParameters.Draw,
RecordsTotal = totalResultsCount,
RecordsFiltered = filteredResultsCount,
// Data = GridData.ToList()
Data = await GridData
.Skip(dtParameters.Start)
.Take(dtParameters.Length)
.ToListAsync()
});
}
//}
//return null;
}
DtParameters dtParameters can't initilize and getting ajaxy error in data loading.
Draw = 0,
search = null
column = null
length = null
[HttpPost]
public async Task LoadTable(DtParameters dtParameters, int districtid, int schoolid)
{
schoolid = 1;
var searchBy = dtParameters.Search?.Value;
Js files
var table;
$(document).ready(function () {
// $.fn.dataTable.moment("DD/MM/YYYY HH:mm:ss");
// $.fn.dataTable.moment("DD/MM/YYYY");
});
function strtrunc(str, num) {
if (str.length > num) {
return str.slice(0, num) + "...";
}
else {
return str;
}
}
function edit(rowContext) {
if (table) {
var data = table.row($(rowContext).parents("tr")).data();
alert("Example showing row edit with id: " + data["id"] + ", name: " + data["name"]);
}
}
The text was updated successfully, but these errors were encountered: