我正在使用 jtable (jtable.org) 并创建了一个我想要的表。我不知道该怎么做是围绕动作做一个if语句'createAction'
jtable api中有一个对象叫做:
TotalRecordCount:记录总数(不仅是本页)。
我想要的是这样的:
if(TotalRecordCount < 5){ createAction: 'PersonActionsPagedSorted.php?orderId=&action=create', }
这是整个代码:
<script type="text/javascript">
jQuery(document).ready(function () {
//Prepare jTable
jQuery('#ext_table').jtable({
//title: 'Create Extensions',
paging: true,
pageSize: 10,
sorting: true,
defaultSorting: 'Extension ASC',
actions: {
listAction: 'PersonActionsPagedSorted.php?orderId=&action=list',
createAction: 'PersonActionsPagedSorted.php?orderId=&action=create',
updateAction: 'PersonActionsPagedSorted.php?action=update',
deleteAction: 'PersonActionsPagedSorted.php?action=delete'
},
fields: {
PersonId: {
key: true,
create: false,
edit: false,
list: false
},
Name: {
title: 'Name',
width: '30%',
sorting:false,
//inputClass: 'validate[required]'
},
emailAddress: {
title: 'Email Address',
width: '20%',
sorting:false
}
});
//Load person list from server
$('#ext_table').jtable('load');
});
</script>