I'm working on AngularJS UI Grid and when I use useExternalPagination,useExternalSorting attributes are true, Rowselection is not working. Below is my grid properties
$scope.gridOption = {
'excessRows': 20,
enableSorting: true,
enableRowSelection: true,
enableRowHeaderSelection: true,
multiSelect: true,
enablePaginationControls: false,
paginationPageSizes: [10,20],
paginationPageSize: 10,
rowHeight: 160,
minRowsToShow: 6,
useExternalPagination: true,
useExternalSorting: true,
rowTemplate: 'temp.html'
};
my external pagination in onRegisterApi,
$scope.gridOption.onRegisterApi = function(gridApi) {
$scope.gridApi = gridApi;
gridApi.pagination.on.paginationChanged($scope, function(newPage, pageSize) {
pagination.pageNumber = newPage;
pagination.pageSize = pageSize;
setData();
});
};
function setData() {
http.get().then(function(data) {
$scope.gridOption.totalItems = data.total;
$scope.gridOption.data = data.grid;
$timeout(function() {
$scope.gridApi.selection.selectRow($scope.gridOption.data[0]);
},1000);
}
As you see above,I'm selecting first data in the grid. $scope.gridApi.selection.selectRow($scope.gridOption.data[0]); but this is not selecting the first row.
if I remove the attributes useExternalPagination, useExternalSorting selectRow is selecting the specified Row..I need to use externalpagination and rowselection options. Am I missing anything in the code?
Any helping hands....
Thanks in Advance!!!
I have created an example pluncker with useExternalPagination, useExternalSorting and enableRowSelection functionalities.
http://plnkr.co/edit/I67c3xTkBeXq5OnMkIad?p=preview
Checklist: 1) Make sure you are using the latest version of the ui-grid(3.0.7).
2) Check whether you have added all the required dependencies.
HTML:
<div ui-grid="gridOptions" ui-grid-selection ui-grid-pagination class="grid"></div>
JS:
$scope.gridOptions = {
paginationPageSizes: [25, 50, 75],
paginationPageSize: 25,
useExternalPagination: true,
useExternalSorting: true,
enableRowSelection: true,
enableSelectAll: true
};