Highlight search text only column have "searchable:true" options

Highlight search text only column have "searchable:true" options

wiwiilawiwiila Posts: 1Questions: 1Answers: 0

This my code : I don't want highlight at active column.
Thank you for your help.

var tchtable = $('#teachers-table').DataTable({
            processing: true,
            serverSide: true,
            aaSorting : [[0, 'desc']],
            ajax: { 
                url: '{{ url("/getTchlist") }}',
                data: {
                    showinactive: {{ $showinactive }},
                },
            },
            columns: [
                { width:'20%',data: 'teacher_id', name: 'teacher_id' },
                { data: 'tch_fname', name: 'tch_fname'@if(\Session::get('locale')== 'en')+'_en'@endif },
                { data: 'tch_lname', name: 'tch_lname'@if(\Session::get('locale')== 'en')+'_en'@endif, orderable: false},
                { data: 'tch_nickname', name: 'tch_nickname' },
                { data: 'active', name: 'active', orderable: false, searchable: false }
            ]
        });
        tchtable.on( 'draw', function () {
            var body = $( tchtable.table().body() );
            body.unhighlight();
            if ( tchtable.rows( { search: 'applied' } ).data().length ) {
                body.highlight( tchtable.search() ); 
            }              
        } );

Answers

  • allanallan Posts: 63,818Questions: 1Answers: 10,517 Site admin

    Good point - thanks for noting this. That is a limitation in the current highlighting plug-in for certain. I'm afraid I don't have an immediate fix, but I do have a not of it to look into it when I can.

    Allan

  • bansal0301bansal0301 Posts: 1Questions: 0Answers: 0

    I am actually new to datatables , can you please share a link of previous plugin also as when i paste above in example code even search box disappears.

This discussion has been closed.