ngekoding/codeigniter-datatables

reorder

Closed this issue · 8 comments

Hello sir, it's not reordering when i press the reordering sign at the table header

Can you add some details?

Because, I was already try the ordering features and working well.

Server:

public function data_perkara_keluar_datatable()
{
    $db = db_connect();
    $queryBuilder = $db->table('perkara')->select('perkara.id, nomor_perkara,kode_box,pihak,tanggal_putusan,tanggal_minutasi,tanggal_bht,klasifikasi')->join('box', 'perkara.id_box=box.id')->where('jenis_box', 'perkara')->where('keluar', 'Y')->orderBy('id', 'asc');

    $datatables = new DataTables($queryBuilder, '4');
    $datatables->addSequenceNumber();
    $datatables->only(['nomor_perkara', 'pihak', 'tanggal_putusan', 'tanggal_bht', 'tanggal_minutasi', 'klasifikasi']);
    $datatables->generate(); // done
}

Client:

$('#data_perkara_keluar').DataTable({
    "processing": true,
    "serverSide": true,
    "order": [],
    "ajax": {
        "url": "<?= base_url('isibox/data_perkara_keluar_datatable'); ?>",
        "type": "POST"
    },
    "columnDefs": [{
            "target": 0,
            "orderable": false,
        },
        {
            responsivePriority: 1,
            targets: 0,

        },

    ],
    rowReorder: {
        selector: 'td:nth-child(2)'
    },
    responsive: true
})

I think I was misunderstanding about the question, so it is about RowReorder not the ordering (orderable) feature, right?

The RowReorder is not tested yet, maybe I will look at this next time.

Thank you

I'm sorry if you couldn't understand my question sir, i'm not quiet familiar with datatable feature, and what is I excactly mean is sorting, indicate with the arrow sign in table's header. I press that sign, but my data is not sorting

Do you need a regular sorting feature or with rowReorder extension?

Here is the example of regular sorting which already supported by this library https://datatables.net/examples/basic_init/zero_configuration.html

And here is the rowReorder example https://datatables.net/extensions/rowreorder/examples/initialisation/simple.html

Which one do you need?

I need the sorting one sir

I use offline version of datatable..maybe i need to try it with the online one or download the latest version of datatable

So that feature was already to this library, you can try to look at the example project here https://github.com/ngekoding/ci-crud