10 examples of 'datatable refresh data' in JavaScript

Every line of 'datatable refresh data' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
2function refresh(){
3 var table = $('.table').DataTable();
4 table.ajax.reload(null,false);// 刷新表格数据,分页信息不会重置
5}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

7function refreshTableRows(table, data) {
8 var tbody = table.find('tbody');
9 // Clear rows
10 tbody.empty();
11
12 // Append all rows
13 $.each(data, function () {
14 var row = '<tr class="ss-gridfield-item">';
15
16 for (var key in this) {
17 var val = this[key];
18 row += '<td>' + val + '</td>';
19 }
20
21 row += '<td><button class="tablefield-btn-remove">-</button></tr>';
22 tbody.append(row);
23 });
24
25}
309refreshData(callback, skipSortAndFilter, hideLoader, forceLoadRows) {
310 if (this.loading) {
311 return this.$q.when();
312 }
313
314 if (!hideLoader) {
315 this.loading = true;
316 this.displayedRows = DatagridController.createEmptyRows(this.paging.getCurrentPageSize());
317 }
318
319 this.selectedRows = this.selectedRows.map(() => false);
320 this.selectAllRows = false;
321
322 this.refreshDatagridPromise = this.$q.when((callback || angular.noop)())
323 .then(() => this.paging.loadData(skipSortAndFilter, forceLoadRows))
324 .then((result) => {
325 this.displayedRows = result.data;
326 if (this.hasActionMenu) {
327 setTimeout(() => this.checkScroll(), checkScrollOnRefreshDataDelay);
328 }
329 })
330 .finally(() => {
331 this.loading = false;
332 this.firstLoading = false;
333 this.refreshDatagridPromise = null;
334 });
335
336 return this.refreshDatagridPromise;
337}
163function reloadTable() {
164 $("#libraryTable").DataTable().ajax.reload();
165}
50update(data) {
51 this.setState({data: data});
52}
97reloadTable() {
98 this.$groupTable
99 .DataTable()
100 .clear()
101 .draw();
102}
115reloadRows () {
116 return this.loadRows(null, true);
117}
75async fetchData() {
76 let transformedData = await this.store.fetchData(this.dataFetchOptions)
77 console.log(transformedData)
78 this.table.update(transformedData)
79}
52getData(params, isRefresh) {
53 const {dispatch} = this.props;
54 if (isRefresh) {
55 params = {
56 keyword: '',
57 pageNo: 1,
58 pageSize: 10,
59 }
60 }
61 dispatch({
62 type: 'clubUnionCadre/queryList',
63 payload: {
64 keyword: '',
65 pageNo: 1,
66 pageSize: 10,
67 ...params
68 }
69 });
70}
637public refreshRender() {
638 if (this.body) {
639 if (!this.body.parent)
640 this.body.parent = this;
641
642 this.dataVirtualScrollService.preparePreviousItemAfterDataChange(this.body);
643 }
644
645 this.prepareItemsPagingAndFilter();
646 this.updatePaginateConfig();
647 this.definePaddingBottom();
648
649 if (!this.infinity && this.body)
650 this.body.backToTheTop();
651}

Related snippets