RowReorder

RowReorder

davinder16davinder16 Posts: 2Questions: 1Answers: 0

Please help me how i can add RowReorder in the following code

var grid = new Datatable();
grid.init({
src: $("#datatable_site"),
onSuccess: function(grid) {
// execute some code after table records loaded
},
onError: function(grid) {
// execute some code on network or other general error
},
dataTable: {
"aLengthMenu": [
[20, 50, 100, 150, 200],
[20, 50, 100, 150, 200] // change per page values here
],

            "iDisplayLength": 20, // default record count per page
            "bServerSide": true, // server side processing
            "sAjaxSource": BASE_URL +"/admin/successStoryList", // ajax source

            "aaSorting": [[1, "asc"]
            ], // set first column as a default sort by asc
            "fnServerParams": function(aoData) {
                aoData.push({
                    "name": "sAction",
                    "value": 'filter'
                });
                aoData.push({
                    "name": "_token",
                    "value": $('#_token').val()
                });
                aoData.push({
                    "name": "mem_username",
                    "value": $('#mem_username').val()
                });
                aoData.push({
                    "name": "status",
                    "value": $('#status').val()
                });
                aoData.push({
                    name: "sGroupActionName",
                    value: sGroupActionName
                });
                aoData.push({
                    name: "id[]",
                    value: id
                });
                aoData.push({
                    name: "key",
                    value: $('#_key').val()
                });
                aoData.push({
                    name: "val",
                    value: $('#_val').val()
                });

            },
            "aoColumns": [
              {
                  "bSearchable": false,
                  "bSortable": false
              },
              {
                    "bSearchable": false,
                    "bSortable": false
                },
                {
                    "bSearchable": false,
                    "bSortable": false
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },
                {
                    "bSearchable": false,
                    "bSortable": true
                },

            ]
        }
    });

Answers

  • rf1234rf1234 Posts: 2,993Questions: 87Answers: 421

    https://datatables.net/reference/option/rowReorder

    read the docs please... this is not a free coding service :smile:

  • davinder16davinder16 Posts: 2Questions: 1Answers: 0

    :) i read this but it did not work for me, please tell me where i should add
    rowReorder: true in the above code?

  • rf1234rf1234 Posts: 2,993Questions: 87Answers: 421

    Looks like you are using an old version of Data Tables. Your syntax is older for sure. You would need to check whether row reorder works for that version.
    If it does I would insert rowReorder: true here:

    grid.init({
    rowReorder: true,
    src: $("#datatable_site"),
    onSuccess: function(grid) {
    // execute some code after table records loaded
    },
    
  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    If you can give us a link to a test case showing the issue, as required in the forum rules, I’ll take a look and debug what it isn’t working for you.

    Allan

This discussion has been closed.