Skip to content

Commit

Permalink
.reloadData() and saveState not working... #266
Browse files Browse the repository at this point in the history
  • Loading branch information
l-lin committed Apr 2, 2015
1 parent 5cd0d07 commit ac18c84
Show file tree
Hide file tree
Showing 23 changed files with 37 additions and 29 deletions.
4 changes: 3 additions & 1 deletion demo/advanced/dataReloadWithAjax.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ <h1><i class="fa fa-play"></i>&nbsp;Load/Reload the table data from an Ajax sour

function DataReloadWithAjaxCtrl(DTOptionsBuilder, DTColumnBuilder, DTInstances) {
var vm = this;
vm.dtOptions = DTOptionsBuilder.fromSource('data.json').withPaginationType('full_numbers');
vm.dtOptions = DTOptionsBuilder.fromSource('data.json')
.withOption('stateSave', true)
.withPaginationType('full_numbers');
vm.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID'),
DTColumnBuilder.newColumn('firstName').withTitle('First name'),
Expand Down
4 changes: 3 additions & 1 deletion demo/advanced/dataReloadWithAjax.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ angular.module('showcase.dataReload.withAjax', ['datatables'])

function DataReloadWithAjaxCtrl(DTOptionsBuilder, DTColumnBuilder, DTInstances) {
var vm = this;
vm.dtOptions = DTOptionsBuilder.fromSource('data.json').withPaginationType('full_numbers');
vm.dtOptions = DTOptionsBuilder.fromSource('data.json')
.withOption('stateSave', true)
.withPaginationType('full_numbers');
vm.dtColumns = [
DTColumnBuilder.newColumn('id').withTitle('ID'),
DTColumnBuilder.newColumn('firstName').withTitle('First name'),
Expand Down
10 changes: 6 additions & 4 deletions dist/angular-datatables.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down Expand Up @@ -1093,14 +1093,16 @@ function dtAjaxRenderer($q, $timeout, DTRenderer, DTRendererService, DT_DEFAULT_

function reloadData() {
if (_oTable) {
var ajaxUrl = renderer.options.ajax.url ||  renderer.options.ajax;
_oTable.ajax.url(ajaxUrl).load();
_oTable.ajax.reload(null, false);
}
}

function changeData(ajax) {
renderer.options.ajax = ajax;
renderer.reloadData();
if (_oTable) {
var ajaxUrl = renderer.options.ajax.url ||  renderer.options.ajax;
_oTable.ajax.url(ajaxUrl).load();
}
}

function rerender() {
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-datatables.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/plugins/bootstrap/angular-datatables.bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/bootstrap/angular-datatables.bootstrap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/bootstrap/datatables.bootstrap.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/bootstrap/datatables.bootstrap.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/colreorder/angular-datatables.colreorder.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/colvis/angular-datatables.colvis.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/colvis/angular-datatables.colvis.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/fixedheader/angular-datatables.fixedheader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/scroller/angular-datatables.scroller.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/plugins/scroller/angular-datatables.scroller.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/plugins/tabletools/angular-datatables.tabletools.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* angular-datatables - v0.4.2
* angular-datatables - v0.4.3
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions src/angular-datatables.renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,16 @@ function dtAjaxRenderer($q, $timeout, DTRenderer, DTRendererService, DT_DEFAULT_

function reloadData() {
if (_oTable) {
var ajaxUrl = renderer.options.ajax.url ||  renderer.options.ajax;
_oTable.ajax.url(ajaxUrl).load();
_oTable.ajax.reload(null, false);
}
}

function changeData(ajax) {
renderer.options.ajax = ajax;
renderer.reloadData();
if (_oTable) {
var ajaxUrl = renderer.options.ajax.url ||  renderer.options.ajax;
_oTable.ajax.url(ajaxUrl).load();
}
}

function rerender() {
Expand Down

0 comments on commit ac18c84

Please sign in to comment.