monkenWu / TablesIgniter

Tableslgniter is an addins base on CodeIgniter4. It will help you use jQuery Datatables in server side mode.
https://tablesigniter.monken.tw/
MIT License
14 stars 7 forks source link

Not working with Searchpanes - Not supported? #4

Closed barentshavet closed 4 years ago

barentshavet commented 4 years ago

Hello (again)

Thanks for sharing your library - it is working very well so far.

I have tried to use the Search panes + Select plugin and it seems it is working to a degree. The search pane is fetching the column results but is not updating the results in the table. Is this plugin not supported or do I have some errors in my code?

image

My code

<script>
    $('#listings').DataTable({
        "aoColumnDefs": [{
            "bSortable": false,
            "aTargets": [1]
        }],
        "order":[],
        "serverSide":true,
        "processing": true,
        "searching": true,
        "searchPanes": {
            "columns": [0,1]
        },
        dom: 'Pfrtip',
        "language" : {
            "decimal":        "",
            "emptyTable":     "No data available in table",
            "info":           "Viser _START_ til _END_ av _TOTAL_ oppdrag",
            "infoEmpty":      "Ingen oppdrag funnet",
            "infoFiltered":   "(filtered from _MAX_ total entries)",
            "infoPostFix":    "",
            "thousands":      ",",
            "lengthMenu":     "Vis _MENU_ oppdrag",
            "loadingRecords": "<h4>Laster inn...</h4>",
            "processing":     "<h4>Laster inn...</h4>",
            "search":         "Søk",
            "zeroRecords":    "Vi fant dessverre ingen oppdrag",
            "paginate": {
                "first": "Første",
                "last": "Siste",
                "next": "Neste",
                "previous": "Forrige",
            }
         },
        "lengthChange":true,
        "pageLength":10,
        "ajax":{
            url:"<?=base_url('/dashboard/firstTable')?>",
            type:'POST'
        }
    });
</script>

Model

    public function noticeTable(){
        $builder = $this->db->table("jobs");
        return $builder;
    }

Controller

    public function firstTable(){
        $this->jobs = new \App\Models\Jobs();
        $table = new TablesIgniter();
        $table->setTable($this->jobs->noticeTable())
            ->setOutput(['jobs_title', 'jobs_created_at'])
            ->setDefaultOrder("jobs_id","DESC")
            ->setSearch(["jobs_title"]);
        return $table->getDatatable();
    }
monkenWu commented 4 years ago

Maybe you can check if your library has been update to v1.3.1. This version fixes an error that can occur if only a single table column is specified when performing a search. About the "Search panes" plugin I may need to test for compatibility. In fact, this library you are using is only support for the default jQuery datatables.

barentshavet commented 4 years ago

Hey

Yes, it is updated, so probably not supported by the library.

It would be lovely to see support for search panes as well one day!

monkenWu commented 4 years ago

Thank you for trying. I will add this feature in the future.