Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82441

New Edit Delete Buttons

$
0
0

hello,

so i am a little new to programming and very new to Datatables, i am creating an app that has multiple tables on one page.
i have run into a dead end on getting the "New, Edit and Delete" buttons to show up for each table.

If possible i would also like to have a "add new row" for some of the entries as some of the records will have more then one data set, again if at all possible.

i apologize for my new-ness to all of this, infact this is the first time i have ever asked a forum a coding question.

please excuse the messy code, like i said i am pretty new. any help is greatly appreciated.

    <!doctype html>
    <html class="no-js" lang="">
        <head>
            <meta charset="utf-8">
            <meta http-equiv="x-ua-compatible" content="ie=edge">
            <title></title>
            <meta name="description" content="">
            <meta name="viewport" content="width=device-width, initial-scale=1">
    
            <link rel="manifest" href="site.webmanifest">
            <link rel="apple-touch-icon" href="icon.png">
            <!-- Place favicon.ico in the root directory -->
    
            <link rel="stylesheet" href="css/normalize.css">
            <link rel="stylesheet" href="css/main.css">
             <script src="js/vendor/modernizr-3.5.0.min.js"></script>
            <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
            <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.2.1.min.js"><\/script>')</script>
            <script src="js/plugins.js"></script>
            <script src="js/main.js"></script>
    
            <!-- Google Analytics: change UA-XXXXX-Y to be your site's ID. -->
            <script>
                window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
                ga('create','UA-XXXXX-Y','auto');ga('send','pageview')
            </script>
            <script src="https://www.google-analytics.com/analytics.js" async defer></script>
            <link rel="stylesheet" type="text/css" href="C:\Users\jesse\Downloads\DataTables\Buttons-1.5.6\css\buttons.bootstrap.css">
            <script type="text/javascript" src="C:\Users\jesse\Downloads\DataTables\Buttons-1.5.6\js\buttons.bootstrap.js"></script>

        </body>
        </head>
        <body>
            <!--[if lte IE 9]>
                <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="https://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
            <![endif]-->
    
            <!-- Add your site or application content here -->



    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        
        <title>DataTables Editor - Cowpedia</title>

        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fh-3.1.4/kt-2.5.0/r-2.2.2/rr-1.2.4/sc-2.0.0/sl-1.3.0/datatables.min.css">
        <link rel="stylesheet" type="text/css" href="css/generator-base.css">
        <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

        <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/jszip-2.5.0/pdfmake-0.1.36/dt-1.10.18/b-1.5.6/b-colvis-1.5.6/b-flash-1.5.6/b-html5-1.5.6/b-print-1.5.6/fh-3.1.4/kt-2.5.0/r-2.2.2/rr-1.2.4/sc-2.0.0/sl-1.3.0/datatables.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>





    </head>
    <body class="dataTables">
        <div class="container">

<script>
    $(document).ready(function() {
    $('table.display').DataTable();
} );</script>

<script>$('#mytable').DataTable( {
    ajax: '/api/staff',
    dom: 'Bfrtip',
    table: 'Cowpedia1'
    columns: [
        { data: 'first_name' },
        { data: 'last_name' },
        // etc
    ],
    select: true,
    buttons: [
        { extend: 'create', editor: editor },
        { extend: 'edit',   editor: editor },
        { extend: 'remove', editor: editor }
    ]
} );</script>
<script>$('#mytable').DataTable( {
    ajax: '/api/staff',
    dom: 'Bfrtip',
    table: 'Cowpedia2'
    columns: [
        { data: 'first_name' },
        { data: 'last_name' },
        // etc
    ],
    select: true,
    buttons: [
        { extend: 'create', editor: editor },
        { extend: 'edit',   editor: editor },
        { extend: 'remove', editor: editor }
    ]
} );</script>

<script>$('#mytable').DataTable( {
    ajax: '/api/staff',
    dom: 'Bfrtip',
    table: 'Cowpedia3'
    columns: [
        { data: 'first_name' },
        { data: 'last_name' },
        // etc
    ],
    select: true,
    buttons: [
        { extend: 'create', editor: editor },
        { extend: 'edit',   editor: editor },
        { extend: 'remove', editor: editor }
    ]
} );</script>

<br>
<br>
<br>            
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia1" width="100%">

                <thead>
                    <tr>
                        <th>Name/ID</th>
                        <th>Date</th>
                        <th>Sire</th>
                        <th>Dame</th>
                        <th>MGD</th>
                        <th>Birthdate</th>
                        <th>Born Organic</th>
                        <th>Breed</th>
                        <th>DHIA Tag</th>
                        <th>Notes</th>
                    </tr>
                </thead>
            </table>

        </div>
    </body>
<!-----General Table---->
<br>
<br>


    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />


        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.css">
        <link rel="stylesheet" type="text/css" href="css/generator-base.css">
        <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

        <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>

    </head>
    <body class="dataTables">
        <div class="container">

    <br>
    <br>
    <br>        
            
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia2" width="100%">
                <thead>
                    <tr>
                        <th>Date</th>
                        <th>Breeding Record</th>
                        <th>Calving Record</th>
                    </tr>
                </thead>
            </table>

        </div>
    </body>
<!--------Breeding Record Table----->
<br>
<br>



    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        
    

        <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.css">
        <link rel="stylesheet" type="text/css" href="css/generator-base.css">
        <link rel="stylesheet" type="text/css" href="css/editor.dataTables.min.css">

        <script type="text/javascript" charset="utf-8" src="https://cdn.datatables.net/v/dt/jqc-1.12.4/moment-2.18.1/dt-1.10.18/af-2.3.3/b-1.5.6/b-colvis-1.5.6/b-print-1.5.6/cr-1.5.0/fc-3.2.5/fh-3.1.4/kt-2.5.0/r-2.2.2/rg-1.1.0/sl-1.3.0/datatables.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/dataTables.editor.min.js"></script>
        <script type="text/javascript" charset="utf-8" src="js/table.Cowpedia.js"></script>
    </head>
    <body class="dataTables">
        <div class="container">

    <br>
    <br>
    <br>
            
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="Cowpedia3" width="100%">
                <thead>
                    <tr>
                        <th>Date</th>
                        <th>Condition</th>
                        <th>Treatment</th>
                    </tr>
                </thead>
            </table>

        </div>
    </body>
</html>

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


Viewing all articles
Browse latest Browse all 82441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>