jqueryjquery-jtable

Full set of options for creating a jQuery jTable


I'm able to create a jQuery jTable but I want to configure it differently than the table created by the example I'm working from.

http://jtable.org/GettingStarted

I'm not seeing a place where I might find a list of configurable options that can be used when the table is create in the documentation.

http://jtable.org/Home/Documents

Does this type of documentation exist somewhere?

For example, how do I create the jTable without the "Add new record" option?

This is the code I have so far:

<%@ include file="/WEB-INF/jsp/headerfooter/header/pageHeader.jsp"%>
<html>

    <head>

        <!-- jQuery-ui dependencies (needed by jQuery jTable) -->
        <script src="${home}/static/jquery-ui-1.12.1/jquery-ui.min.js" type="text/javascript"></script>

        <!-- jQuery jTable dependencies -->
        <link href="${home}/static/jtable.2.4.0/themes/metro/blue/jtable.min.css" rel="stylesheet" type="text/css" />
        <script src="${home}/static/jtable.2.4.0/jquery.jtable.min.js" type="text/javascript"></script>

        <script type="text/javascript">
            $(document).ready(function () {
                $('#PersonTableContainer').jtable({
                    title: 'Table of people',
                    actions: {
                        listAction: '/GettingStarted/PersonList',
                        createAction: '/GettingStarted/CreatePerson',
                        updateAction: '/GettingStarted/UpdatePerson',
                        deleteAction: '/GettingStarted/DeletePerson'
                    },
                    fields: {
                        PersonId: {
                            key: true,
                            list: false
                        },
                        Name: {
                            title: 'Author Name',
                            width: '40%'
                        },
                        Age: {
                            title: 'Age',
                            width: '20%'
                        },
                        RecordDate: {
                            title: 'Record date',
                            width: '30%',
                            type: 'date',
                            create: false,
                            edit: false
                        }
                    }
                });
            });
        </script>
    </head>

    <div id="PersonTableContainer"></div>

</html>

Solution

  • Here's your full list of customization options for jTable: http://jtable.org/ApiReference/GeneralOptions

    Although the documentation is a little scarce on removing the "add new record" button, you could try setting addRecordButton to false in the initialization options.

    $('#PersonTableContainer').jtable({
        addRecordButton: false
    });