0

使用 jquery jtable 但不显示记录列表...在前端,当数据库中有 10 条记录时,此显示数据不可用。

    <link href="themes/redmond/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
    <link href="Scripts/jtable/themes/lightcolor/blue/jtable.css" rel="stylesheet" type="text/css" />

    <script src="jquery-1.6.4.min.js" type="text/javascript"></script>
    <script src="jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

    <script src="jquery.jtable.min.js" type="text/javascript"></script>
    <script src="jquery.jtable.js" type="text/javascript"></script>

    <script type="text/javascript">

        jQuery(document).ready(function() {

            //Prepare jTable
            jQuery('#PeopleTableContainer').jtable({
                title: 'Table of people',
                paging: true,
                pageSize: 2,
                sorting: true,
                defaultSorting: 'Name ASC',
                actions: {
                    listAction: 'PersonActions.php?action=list',
                    createAction: 'PersonActions.php?action=create',
                    updateAction: 'PersonActions.php?action=update',
                    deleteAction: 'PersonActions.php?action=delete'
                },
                fields: {
                    id: {
                        key: true,
                        create: false,
                        edit: false,
                        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
                    }
                }
            });

            //Load person list from server
            jQuery('#PeopleTableContainer').jtable('load');

        });

    </script>


</head>
<body>
    <div id="PeopleTableContainer"></div>
</body>

4

1 回答 1

0

您必须检查另一个页面“PersonActions.php”。

首先,如果字段类似于 (id,name,age,date),您必须在该位置当前输入表格字段,您必须像这样输入

fields: {
    id: {
        key: true,
        create: false,
        edit: false,
        list: false
    },
    name: {
        title: 'Author Name',
        width: '40%'
    },
    age: {
        title: 'Age',
        width: '20%'
    },
    date: {
        title: 'Record date',
        width: '30%',
        type: 'date',
        create: false,
        edit: false
    }
}

在“PersonActions.php”中,你必须检查连接、查询和每一件事

于 2014-02-14T13:24:34.857 回答