Main jQuery code pasted below.............

Main jQuery code pasted below.............

gitanjaligitanjali Posts: 4Questions: 1Answers: 0
edited March 2016 in Free community support
<script src="templates/jsn_solid_free/js/jquery.min.js"></script>
 <script src="templates/jsn_solid_free/js/admin.js"></script>
    <link rel="stylesheet" type="text/css" href="templates/jsn_solid_free/js/jquery.dataTables.css">
        <script type="text/javascript" language="javascript" src="templates/jsn_solid_free/js/jquery.js"></script>
        <script type="text/javascript" language="javascript" src="templates/jsn_solid_free/js/jquery.dataTables.js"></script>
        <script type="text/javascript" language="javascript" class="init">
        var editor; // use a global for the submit and return data rendering in the examples

            $(document).ready(function() {

                var dataTable = $('#student-grid').DataTable( {
                    "processing": true,
                    "serverSide": true,
                    "ajax":{
                        url :"../../templates/jsn_solid_free/js/student-grid-data.php", // json datasource
                        type: "post",  // method  , by default get
                        error: function(){  // error handling
                            $(".employee-grid-error").html("");
                            $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th colspan="3">No data found in the server</th></tr></tbody>');
                            $("#employee-grid_processing").css("display","none");
                            
                        }
                    }
                } );
    
    editor = new $.fn.dataTable.Editor( {
        ajax: "../../templates/jsn_solid_free/Data_Table/examples/php/staff.php",
        table: "#example",
        fields: [ {
                label: "First name:",
                name: "first_name"
            }, {
                label: "Last name:",
                name: "last_name"
            }, {
                label: "Position:",
                name: "position"
            }, {
                label: "Office:",
                name: "office"
            }, {
                label: "Extension:",
                name: "extn"
            }, {
                label: "Start date:",
                name: "start_date"
            }, {
                label: "Salary:",
                name: "salary"
            }
        ]
    } );

    var table = $('#example').DataTable( {
        dom: "Bfrtip",
        ajax: "../../templates/jsn_solid_free/Data_Table/examples/php/staff.php",
        columns: [
            { data: null, render: function ( data, type, row ) {
                // Combine the first and last names into a single table field
                return data.first_name+' '+data.last_name;
            } },
            { data: "position" },
            { data: "office" },
            { data: "extn" },
            { data: "start_date" },
            { data: "salary", render: $.fn.dataTable.render.number( ',', '.', 0, '$' ) }
        ],
        select: true,
        buttons: [
            { extend: "create", editor: editor },
            { extend: "edit",   editor: editor },
            {
                extend: "selectedSingle",
                text: "Salary +250",
                action: function ( e, dt, node, config ) {
                    // Immediately add `250` to the value of the salary and submit
                    editor
                        .edit( table.row( { selected: true } ).index(), false )
                        .set( 'salary', (editor.get( 'salary' )*1) + 250 )
                        .submit();
                }
            },
            { extend: "remove", editor: editor }
        ]
    } );  




            } );
        </script>

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Replies

  • allanallan Posts: 63,761Questions: 1Answers: 10,510 Site admin

    I'm afraid I don't know what the issue as you haven't added any explanation just a code dump. What is the problem? Also, can you link to a page showing the error so it can be debugged please.

    Allan

This discussion has been closed.