你好,我有以下代码片段。 部门
table_1.created_at
这些是我用于刷新功能的两个版本
第一
function refresh(){
<div>Users </div> <div id="UserTableContainer"></div> <script type="text/javascript"> var departmentChangeId = 1; $(document).ready(function () { $('#DepartmentTableContainer').jtable({ paging: true, useBootstrap: true, sorting: true, selecting: true, selectOnRowClick: true, title: 'Departments', actions: { listAction: '/api/Department/GetDepartmentList', createAction: '/api/Department/CreateDepartment', updateAction: '/api/Department/EditDepartment', deleteAction: '/api/Department/DeleteDepartment' }, fields: { ID: { key: true, list: false }, TypeId: { title: 'Department Type', options: '/api/Department/GetDepartmentTypeList' }, Label: { title: 'Department' }, }, //Register to selectionChanged event to hanlde events selectionChanged: function () { //Get all selected rows var $selectedRows = $('#DepartmentTableContainer').jtable('selectedRows'); departmentChangeId = $selectedRows.data('record').ID; //alert(departmentChangeId); // refresh(); } }).jtable('load'); $('#UserTableContainer').jtable({ messages: ArabMessages, //Lozalize paging: true, useBootstrap: true, sorting: true, title: 'Employee', actions: { listAction: '/api/Users/GetEmployee?id=' + departmentChangeId, updateAction: '/api/Users/EditEmployee' }, fields: { Id: { key: true, list: false }, DepId: { title: ' Department', options: '/api/Department/GetDepartmentTypeList' }, LastName: { title: 'Name' }, } }); $('#UserTableContainer').jtable('load'); });
第二个
不幸的是,他们两个都不工作 而不是当我使用调试模式时,我发现在两种情况下都访问了/ api / Users / GetEmployeefunction refresh(){ $ .post(&#34; / api / Users / GetEmployee&#34;,&#34; id =&#34; + departmentChangeId, 功能(结果){ $(&#39;#UserTableContainer&#39)的JTable。(&#39;重新加载&#39); } ,&#34; json&#34;);
$('#UserTableContainer').jtable('reload'); }
答案 0 :(得分:1)
请尝试在刷新功能中使用以下代码
$('#UserTableContainer').jtable('load');