Simple inline editiing

Simple inline editiing

susersuser Posts: 68Questions: 18Answers: 0
edited October 2016 in Free community support

I try this
https://editor.datatables.net/examples/inline-editing/simple

and i modified i code like this

 <script type="text/javascript">
        var editor; // use a global for the submit and return data rendering in the examples

        $(document).ready(function () {
            editor = new $.fn.dataTable.Editor({
                ajax: "../php/staff.php",
                table: "#example",
                fields: [{
                    label: "RegionID:",
                    name: "RegionID"
                }, {
                    label: "Region:",
                    name: "Region"
                }, {
                    label: "StartDate:",
                    name: "StartDate"
                }, {
                    label: "EndDate:",
                    name: "EndDate"
                }               
                ]
            });

            // Activate an inline edit on click of a table cell
            $('#example').on('click', 'tbody td:not(:first-child)', function (e) {
                editor.inline(this);
            });

            $('#example').DataTable({
                dom: "Bfrtip",
                ajax: "../php/staff.php",
                columns: [
                    {
                        data: null,
                        defaultContent: '',
                        className: 'select-checkbox',
                        orderable: false
                    },
                    { data: "RegionID" },
                    { data: "Region" },
                    { data: "StartDate" },
                    { data: "EndDate" },
                    
                ],
                select: {
                    style: 'os',
                    selector: 'td:first-child'
                },
                buttons: [
                    { extend: "create", editor: editor },
                    { extend: "edit", editor: editor },
                    { extend: "remove", editor: editor }
                ]
            });
        });

    </script>

<script type="text/javascript">

    function data(){
        $.ajax({
            type: "POST",
            url: "Maintenance.aspx/data",
            //data: "",
            contentType: "application/json;charset=utf-8",
            dataType: "json",
            async: true,
            cache: false,
            success: function (result) {

                var re = JSON.parse(result.d).response;
                console.log(JSON.parse(result.d).response);
                $("#tabledata").empty()

                if(re.length >0)
                {
                    $("#tabledata").append
                    ("<thead><tr><th>RegionID</th><th>Region</th><th>StartDate</th><th>EndDate</th>");

                    for(var i=0;i<final.length;i++)
                    {
                        if(re[i]!==null)
                        {
                            $("#tabledata").append("<tbody><tr><td>" +
                                re[i][0] + "</td><td>" +
                                re[i][1] + "</td><td>" +
                                re[i][2] + "</td><td>" +
                                re[i][3] + "</td></tr></tbody>");
                        }
                    }


                }
            },
            error:function(error)
            {
                alert(Error);
            }
        });
    }
</script>

now what i write here instead of this

ajax: "../php/staff.php",

Answers

This discussion has been closed.