如何过滤数据表以仅显示JSON给出的特定内容?

时间:2019-10-17 17:00:28

标签: javascript datatables

我正在尝试过滤job_titles如果匹配,然后允许,但是如果不匹配,则不要在数据表中显示它,但是,我执行此工作的旧函数确实无法正常工作,因为过滤还可以,但只显示匹配的内容,但我不想显示不正确的内容

rowCallback: function( row, data ) {
  let matches = 0;
  for (var i = 0; i < job_title.length; i += 1) {
    if (data.job_title.indexOf(job_title[i]) == -1) {
      matches++;
    }else{  
      $(row).css({
            'background-color': '#dff0d8'
        });
    }
  }
}
var keywords = ['aslr', 'ida pro', 'gdb', 'windbg', 'immunity debugger', 'boofuzz', 'peach fuzzer', 'winafl', 'python', 'assembly', 'penetration testing', 'exploits', 'metasploit', 'metasploit framework', 'ethical hacker', 'pentest', 'computer security', 'hacking', 'oscp', 'osce', 'osee', 'penetration testing', 'offensive security', 'mitre att&ck', 'vulnerability research', 'vulnerability researcher', 'fuzzing', 'clang', 'llvm', 'address sanitizer', 'afl', 'fuzzers','penetration tester']
    var job_title = ['penetration tester','penetration testing', 'offensive security', 'vulnerability researcher','software','security','developer','ethical hacker','cyberSécurité','threat','it Security','application security','information security','security engineer','product security','cyber security','software engineer','security analyst','consultant cyber sécurité','ingénieur cybersécurité','penetration test consultant','Penetrationstestare']
"ajax": {
            "url": "/index_get_data",
            "dataType": "json",
            "dataSrc": function(json){
              let matches = 0;
              let data = json.jobs
              var filtered = data.filter(function(value,index,arr){
                return value.job_title != 'aircraft maintenance engineer - mel'
              });
              return filtered;
            },
            "contentType":"application/json"
        },

json

{city: "San Pedro Garza García, N. L.", company: "CEMEX", date: "hace 13 días", job_description: "we're looking for a talented professional to staff…sualization tools software.↵attention to details.", job_title: "(cen) process assessment consultant", …}
city: "San Pedro Garza García, N. L."
company: "CEMEX"
date: "hace 13 días"
job_description: "we're looking for a talented professional to staff the position of (cen) process assessment consultant.↵only resumes in english↵main accountabilities:↵the process assessment consultant will provide our stakeholders, management and audit committee an independent and objective evaluation and assessment concerning the level of exposure to risk throughout all the processes of the organization. to add value by helping all the operations to improve and strengthen the effectiveness of risk management, control systems and by sharing with them the best practices identified worldwide.↵challenges of the position:↵participate in the execution of the corporate annual audit plan:↵↵a) perform pre-designed audit tests to measure operational efficiency and compliance with cemex worldwide standards and international regulations.↵↵b) apply appropriate audit techniques to identify weaknesses in the internal control environment and report how effectively the existing controls are working in ordinary and special audits.↵↵c) lead audits by country or by process including resource and team management.↵↵d) responsible in the elaboration and presentation of audit reports to the highest levels of the company in which risks, policies non-compliances and any other deviations are informed.↵↵e) obtain remediation plans from the operations regarding observations raised in the audits and in some cases follow up commitments to correct such observations.↵↵f) after a certain tenure in process assessment, participate in training and coaching program for newest members in the department.↵collaboration in the identification of best practices during audit execution. identify best practices and local initiatives that were already tested, that could be shared annually worldwide for others to apply in their operations.↵administrative tasks.↵↵a) collaborate with management team in process assessment’s internal indicators monitoring, such as, internal travel expense budget, high level reporting (audit committee, executive committee) writing reviews, external surveys, report tracking, etc.↵↵b) design, modify and maintain the audit test inventory (pacs) of assigned processes as a result of changes or updates of the company’s internal control environment or structure.↵internal relations:↵interact with country managers , area vp´s and operational and administrative management in the different businesses and countries in which cemex operates.↵qualificationsrequirements:↵3+ years work experience in auditing or consulting, or in cemex’s own operation.↵sap knowledge. data analytics desirable↵audit-specific training is desirable (sarbanes oxley, fcpa, coso, risk management)↵experience in financial and process auditing.↵experience in cemex´s main processes such as cement, ready mix and aggregates operations, commercial, logistics, procurement, corporate finance and human resources as well as bso main functions like accounting, treasury and commercial administration in cemex or any other international company.↵oral and written communication abilities in order to prepare and communicate information to mid-upper management of the organization.↵willingness to travel locally and internationally for audit puposes (up to 45% of the year).↵technical skills:↵mba / msc and bachelors in engineering, accounting, finance or economics.↵↵acca qualification / cia / cfe desirable.↵spanish, english (bulats >= 75 or c1). desirable: french or german.↵sap, windows office. desirable: tableau, r, sql, python↵capable of working in a multicultural environment and multi level organization. experience in motivating, coaching, team building, knowledge transfer etc.↵self-driven, flexible, willingness to work in office and on the field.↵extract and analyze big data.↵able to use and interact with data management and visualization tools software.↵attention to details."
job_title: "(cen) process assessment consultant"
url: ["https://www.indeed.com.mx/rc/clk?jk=a455

0 个答案:

没有答案