Datatables filter numbers greater than

后端 未结 2 960
感动是毒
感动是毒 2021-01-22 22:04

I am using datables, I need to filter particular column whose values are greater than 50 , I tried below code , but nothing happens

oTable.api().column( 10 )
           


        
2条回答
  •  误落风尘
    2021-01-22 22:52

    If you want to check any number greater than 5 then you can write ternary conditional with the hidden column in dataTable. Using filter add MORETHAN5RECORD as a value in the select dropdown to filter greater than 5 records.

    Here is the Code :
    var table = $('#record_table').DataTable({});
    $('.FILTERCLASS').on('keyup change', function () {
    		buildFilters(table,this);
    });	
    	
    function buildFilters(table, element){					
        var type = $(element).data('type'),
            col = $(element).data('col'),
            id = $(element).id;   
          table
              .column( col )
              .search( element.value )
              .draw();
        }
     = 5) ? $val['xyz']."(MORETHAN5RECORD)" : $val['xyz']); ?>  

提交回复
热议问题