I’m using a form to add data to the database and an Angular UI grid with pagination to show database data in the front. I want to reload the Angular UI gird every time I submit the form.
In jQuery I have used ,
function submitForm() {
.
. /* form submitting process */
.
$('#datatable').dataTable().fnReloadAjax(); // to reload table
}
In AngularJs I used ,
(as mentioned in this)
$scope.submitForm = function() {
.
. /* form submitting process */
.
$scope.gridApi.core.refresh(); // to reload table
}
$scope.gridApi.core.refresh() is not working and it doesn’t give the expected result as fnReloadAjax().
I want to know how to get the fnReloadAjax() result in Angular UI grid
further – here is my gridOptions code.
$scope.gridOptions = {
paginationPageSizes: [5, 10, 20],
paginationPageSize: 5,
columnDefs: [
{name: 'name', enableColumnMenu: false},
{name: 'username', enableColumnMenu: false}
]
, onRegisterApi: function (gridApi) {
$scope.gridApi = gridApi;
gridApi.pagination.on.paginationChanged(
$scope,
function (newPage, pageSize) {
.
.
.
});
}
};
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/10/18/jquery-datatables-fnreloadajax-equivalent-in-angular-ui-grid/
via @lzomedia #developer #freelance #web #lzomedia.com
No comments:
Post a Comment