1

I have a controller with method return the Datatables following

return Datatables::of($menu)
-> edit_column('name', '<a href="{{{ URL::to(\'admin/project/\' . $id ) }}}" >{{$name}}</a>')
-> add_column('actions', '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" ><span class="glyphicon glyphicon-pencil"></span>  {{ Lang::get("admin/modal.edit") }}</a>')
-> make();

ajax script to retrieve data

<script type="text/javascript">
    var oTable;
    $(document).ready(function () {
        oTable = $('#table').dataTable({
            "sDom": "<'row'<'col-md-6'l><'col-md-6'f>r>t<'row'<'col-md-6'i><'col-md-6'p>>",
            "sPaginationType": "bootstrap",

            "bProcessing": true,
            "bServerSide": true,
            "sAjaxSource": "{{ URL::to('admin/menu/data/'.((isset($album))?$album->id:0)) }}",
            "fnDrawCallback": function (oSettings) {
                $(".iframe").colorbox({
                    iframe: true,
                    width: "80%",
                    height: "80%",
                    onClosed: function () {
                        window.location.reload();
                    }
                });
            }
        });
        var startPosition;
        var endPosition;
        $("#table tbody").sortable({
            cursor: "move",
            start: function (event, ui) {
                startPosition = ui.item.prevAll().length + 1;
            },
            update: function (event, ui) {
                endPosition = ui.item.prevAll().length + 1;
                var navigationList = "";
                $('#table #row').each(function (i) {
                    navigationList = navigationList + ',' + $(this).val();
                });
                $.getJSON("{{ URL::to('admin/menu/reorder') }}", {
                    list: navigationList
                }, function (data) {
                });
            }
        });
    });
</script>

the edit_column work but the add_column display nothing (also no errors), anyone know what the problems?

1 Answer 1

1
->addColumn('actions', function ($menu) {
$test = '<a href="{{{ URL::to(\'admin/photo/\' . $id . \'/edit\' ) }}}" class="btn btn-success btn-sm iframe" ><span class="glyphicon glyphicon-pencil"></span>  {{ Lang::get("admin/modal.edit") }}</a>';
return $test;
})->make();
Sign up to request clarification or add additional context in comments.

5 Comments

still display nothing, but when i access localhost/myapp/public/admin/menu/data/0, the action column shown as json
i think the response is ok, but the column (the responsed data) was not attached to the table
Have you shown actions columns in your blade file / related js file ?
no, i searched the "actions" in source code, nothing was found
i also can't find "actions" in json when i access localhost/myapp/public/admin/menu/data/0,

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.