使用javascript进行数据表筛选不起作用

使用javascript进行数据表筛选不起作用,javascript,jquery,datatable,filtering,Javascript,Jquery,Datatable,Filtering,我的html中有下表: 序列号 日期时间 INSS 突变 旧价值 新价值 我希望能够过滤列。 我补充说: 我添加了以下代码: $(文档).ready(函数(){ var datatable=$(“#mutationlogs”).datatable({ “命令”:错误, “搜索”:没错, “信息”:正确, “处理”:对, “服务器端”:正确, “pagingType”:“简单编号”, “sDom”:“, “ajax”:{ “url”:“@url.Action(“GetMutationLo

我的html中有下表:


序列号
日期时间
INSS
突变
旧价值
新价值
我希望能够过滤列。 我补充说:


我添加了以下代码:


$(文档).ready(函数(){
var datatable=$(“#mutationlogs”).datatable({
“命令”:错误,
“搜索”:没错,
“信息”:正确,
“处理”:对,
“服务器端”:正确,
“pagingType”:“简单编号”,
“sDom”:“,
“ajax”:{
“url”:“@url.Action(“GetMutationLogs”,“Logs”)”,
“类型”:“职位”
},
“栏目”:[
{“name”:“@Constants.MutationLogColumnNames.SequenceNumber”},
{“name”:“@Constants.MutationLogColumnNames.DateTime”},
{“name”:“@Constants.MutationLogColumnNames.INSS”},
{“name”:“@Constants.MutationLogColumnNames.MutationAction”},
{“name”:“@Constants.MutationLogColumnNames.OldValue”},
{“name”:“@Constants.MutationLogColumnNames.NewValue”},
]
});
$('#mutationlogs thead tr').clone(true).appendTo('#mutationlogs thead');
$('#mutationlogs thead tr:eq(1)th')。每个(函数(i){
var title=$(this.text();
$(this.html(“”);
$('input',this).on('keyup change',function(){
if(datatable.column(i).search()!==此.value){
数据表
.第(i)栏
.search(此.value)
.draw();
}
});
});
});
但是,当我在用于筛选的某个字段中键入值时,我的表不会被筛选。 在调试过程中,我确实得到了进行过滤的代码。但它似乎没有过滤

我忘了什么

这是我的服务器端代码:

DataTable dt = new DataTable();
        Workbook wb;

        string[] files = Directory.GetFiles(@"c:\Logs\", "mutations*.xls");

        var mutations = new List<Mutation>();

        foreach (var file in files)
        {
            var sequencenumber = file.Split('_')[2].Split('.')[0];

            wb = new Workbook(file);
            dt = wb.Worksheets[0].Cells.ExportDataTable(1, 0, wb.Worksheets[0].Cells.MaxDataRow + 1, wb.Worksheets[0].Cells.MaxDataColumn + 1);

            foreach (DataRow dataRow in dt.Rows)
            {
                if (dataRow[0].ToString() != "")
                {
                    Mutation mutation = new Mutation();
                    mutation.SequenceNumber = sequencenumber;
                    ...

                    bool exists = mutations.Any(m => m.SequenceNumber == mutation.SequenceNumber && m.INSS == mutation.INSS && m.OldValue == mutation.OldValue && m.NewValue == mutation.NewValue && m.MutationAction == mutation.MutationAction);

                    if (!exists)
                    { mutations.Add(mutation); }
                }
            }

            dt = wb.Worksheets[1].Cells.ExportDataTable(1, 0, wb.Worksheets[0].Cells.MaxDataRow + 1, wb.Worksheets[0].Cells.MaxDataColumn + 1);
            foreach (DataRow dataRow in dt.Rows)
            {
                if (dataRow[0].ToString() != "")
                {
                    Mutation mutation = new Mutation();
                    ...
                    mutation.Timestamp = String.Format("{0:dd/MM/yyyy HH:mm:ss}", dataRow[2]);
                    mutation.OldValue = dataRow[3].ToString();
                    mutation.NewValue = dataRow[4].ToString();

                    bool exists = mutations.Any(m => m.SequenceNumber == mutation.SequenceNumber && m.INSS == mutation.INSS && m.OldValue == mutation.OldValue && m.NewValue == mutation.NewValue && m.MutationAction == mutation.MutationAction);

                    if (!exists)
                    { mutations.Add(mutation); }
                }
            }

        };

        var count = mutations.Count();
        var result = mutations.Distinct().OrderByDescending(t => t.SequenceNumber).ThenBy(t => t.INSS)
            .Skip(request.Start)
            .Take(request.Length)
            .ToList();

        return new ContentResult
        {
            Content = JsonConvert.SerializeObject(GetJson(result, request, count)),
            ContentType = "application/json"
        };
DataTable dt=newdatatable();
工作手册wb;
string[]files=Directory.GetFiles(@“c:\Logs\”,“translations*.xls”);
var突变=新列表();
foreach(文件中的var文件)
{
var sequencenumber=file.Split(''.'[2].Split('.')[0];
wb=新工作簿(文件);
dt=wb.Worksheets[0]。Cells.ExportDataTable(1,0,wb.Worksheets[0]。Cells.MaxDataRow+1,wb.Worksheets[0]。Cells.MaxDataColumn+1);
foreach(数据行中的数据行)
{
如果(数据行[0].ToString()!=“”)
{
突变=新突变();
突变。SequenceNumber=SequenceNumber;
...
bool exists=突变.Any(m=>m.SequenceNumber==突变.SequenceNumber&&m.INSS==突变.INSS&&m.OldValue==突变.OldValue&&m.NewValue==突变.NewValue&&m.MutationAction==突变.MutationAction);
如果(!存在)
{突变。添加(突变);}
}
}
dt=wb.Worksheets[1]。Cells.ExportDataTable(1,0,wb.Worksheets[0]。Cells.MaxDataRow+1,wb.Worksheets[0]。Cells.MaxDataColumn+1);
foreach(数据行中的数据行)
{
如果(数据行[0].ToString()!=“”)
{
突变=新突变();
...
mutation.Timestamp=String.Format(“{0:dd/MM/yyyy HH:MM:ss}”,dataRow[2]);
mutation.OldValue=dataRow[3].ToString();
mutation.NewValue=dataRow[4].ToString();
bool exists=突变.Any(m=>m.SequenceNumber==突变.SequenceNumber&&m.INSS==突变.INSS&&m.OldValue==突变.OldValue&&m.NewValue==突变.NewValue&&m.MutationAction==突变.MutationAction);
如果(!存在)
{突变。添加(突变);}
}
}
};
var count=突变。count();
var result=translations.Distinct().OrderByDescending(t=>t.SequenceNumber)。然后是by(t=>t.INSS)
.Skip(请求.Start)
.Take(请求.长度)
.ToList();
返回新的ContentResult
{
Content=JsonConvert.SerializeObject(GetJson(结果、请求、计数)),
ContentType=“应用程序/json”
};

我试过你的脚本,如果只过滤客户端,效果很好。所以我猜问题一定在服务器端脚本中。你也可以在这里分享吗?Ufff不懂那种语言。。。但是,您是否尝试过根据客户端脚本发送的请求,该脚本的结果是否确实有所不同。。。您确定要
“服务器端”:true
。。。在我看来,你好像希望结果被客户过滤?!?