gpt4 book ai didi

jquery - 将记录添加到 jTable jQuery

转载 作者:行者123 更新时间:2023-12-01 03:40:07 26 4
gpt4 key购买 nike

我认为这应该可以用记录填充jTable。我已经尝试了几次,但只显示:

No data available

我做错了什么?

jQuery

$(document).ready(function () {
$('#testjtable').jtable({
title: 'Table of Items',
paging: "true",
sorting: "true",
defaultSorting: "ITEM ASC",
selecting: "true",
multiselect: "true",
selectingCheckboxes: "true",
selectOnRollClick: "yes",
actions: {
    listAction: '',
    createAction: '',
    updateAction: '',
    deleteAction: ''
},
fields: {
    ItemId: {
        key: true,
        list: false
    },
    Item: {
        title: 'ITEM',
        width: '30%'
    },
    Relationship: {
        title: 'RELATIONSHIP',
        width: '20%'
    },
    Type: {
        title: 'TYPE',
        width: '20%',
        type: 'date',
        create: false,
        edit: false
    },
Parent: {
title: 'PARENT',
width: '20%'
}
}
    });

//('#testjtable').jTable('load');
$('#testjtable').jtable('addRecord', {
record: {
ItemId:01,
Item: 'Lagos',
Relationship: 'is a',
Type: 'State',
Parent: Nigeria
},
clientOnly:true
});
});

HTML

<html>
<head>
<link href="jtable.min.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="testjtable"></div>
<script src="jquery-1.10.2.js" type="text/javascript"></script>
<script src="jquery-ui.js" type="text/javascript"></script>
<script src="jquery.jtable.min.js" type="text/javascript"></script>
<script type="text/javascript" src="jtabletest.js"></script>
</body>
</html>

最佳答案

您需要将父列的 括在引号中。

           $('#testjtable').jtable('addRecord', {
record: {
ItemId:01,
Item: 'Lagos',
Relationship: 'is a',
Type: 'State',
Parent: 'Nigeria' // added quotes to the string data
},
clientOnly:true
});

快乐编码:)

关于jquery - 将记录添加到 jTable jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22957968/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com