gpt4 book ai didi

javascript - JQuery DataTable设置默认空搜索Echo参数

转载 作者:太空宇宙 更新时间:2023-11-03 15:41:35 25 4
gpt4 key购买 nike

我在服务器端处理中使用 JQuery DataTable。我写了这段代码:

public List<VacationRequest> GetVacationRequestsWithProfiles(int displayStart, int displayLength, out int allDataCount, out int filteredDatacount, string searchParam = "", string searchDir = "")
{
....

switch(searchDir)
{
case "asc":
requests = requests.OrderBy(x => x.FirstName).ThenByDescending(x=>x.DateEnd).Skip(displayStart).Take(displayLength);
break;
case "desc":
requests = requests.OrderByDescending(x => x.FirstName).ThenByDescending(x=>x.DateEnd).Skip(displayStart).Take(displayLength);
break;
default:
requests = requests.OrderBy(x=>x.VacationRequestState).ThenByDescending(x=>x.DateEnd).Skip(displayStart).Take(displayLength);
break;
}

....
}

问题:当页面加载时,我需要获取此方法的default(空)搜索参数。我该如何解决这个问题?这是 JS 代码的一部分:

  "aoColumns": [
{ "data": "ID", "visible": false, bSortable: false, bSearchable: false },
{ "data": "Name" },
{
"data": "VacationRequestStatus",
bSortable: false,
bSearchable: false,
"mRender": function (data, type, full) {
return '<div class = "' + data + '"> <span class="glyphicon glyphicon-question-sign requested-img"></span> <span class="glyphicon glyphicon-ok accept-img"> </span> <span class="glyphicon glyphicon-remove decline-img"></span> </div>';
}
},
{ "mData": "Position", bSortable: false, bSearchable: false },
{ "mData": "DateStart", bSortable: false, bSearchable: false },
{ "mData": "DateEnd", bSortable: false, bSearchable: false },
{
bSortable: false,
bSearchable: false,
data: null,
className: "center",
defaultContent: '<button class="btn btn-danger decline-button">Decline</button> <button class="btn btn-primary accept-button">Accept</button>'
}
]

最佳答案

因为不知道你把 ajax 放在哪里尝试在 aoColumns 之前的行中添加这个命令

"destroy" : true,
"aoColumns": [

那是停止数据显示的命令,但在搜索数据后会显示希望能解决你的问题

关于javascript - JQuery DataTable设置默认空搜索Echo参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30102799/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com