ngtable

Pagination not working after loading JSON data on Ng-Table

我的梦境 提交于 2019-12-07 09:16:27
问题 I followed the example on http://bazalt-cms.com/ for the pagination but using $http.get instead of hard-coding a variable in the controller. $http.get("data.json").success(function(data){ $scope.dataset = data; } I also moved the $scope.tableParams inside the $http.get $http.get("data.json").success(function(data){ $scope.dataset = data; $scope.tableParams = new ngTableParams({ ... } }); and changed the data variable to $scope.dataset total: $scope.dataset.length, // length of data getData:

ng-table filter with nested properties

北战南征 提交于 2019-12-07 05:42:13
问题 I have following JSON: [{ "Id": "1", "Data": {"Str1": "Ann", "Str2": "Xenna"} },{ "Id": "2", "Data": {"Str1": "Bob","Str2": "Bobby"}, }] And I created ng-table to display it. I tried to add filter. When I filter by Id everything works as expected (filter is { "Id": "2" } ). But I cannot create proper filter do Str1 and Str2 fields. I already tried: { "Str1": "A" } { "Data.Str1": "A" } { "Data['Str1']": "A" } but above options does not work. Example of my work is here: http://plnkr.co/edit

ngtable : sort and filter on nested object

﹥>﹥吖頭↗ 提交于 2019-12-07 04:05:27
问题 I have a list of objects to display on a table with ngTable. My object looks like : obj {label:string, nestObj{nestLabel:string } } In my controller I want to allow sorting and filtering on fields 'label' and 'nestObject.label'. I have tried this: $scope.tableParams = new ngTableParams({ page: 1, // show first page count: 10, filter: { label='', nestObj.label='' }, sorting: { label: 'asc', nestObj.label: 'asc' } }, { total: data.length, // length of data getData: function($defer, params) { //

ngtable server side pagination

本秂侑毒 提交于 2019-12-07 01:56:53
问题 Hello I try figure out how make server side pagination with angularjs an ngtable. I have two web services: localhost:8080/app/api/period Method GET return json list of entities. As parameters are passed page number, range of start period and range when it stop. localhost:8080/app/api/period/count Method GET return count of periods. As parameters are passed range of start period and range when it stop. this.tableParams = new ngTableParams({ page: 1, count: 10 }, { counts: [10], total: 0,

sorting feature in ngTable using Jasmine Testing

帅比萌擦擦* 提交于 2019-12-06 12:08:45
问题 I have created an application using ng-table , the application is working fine but i don'nt know how to write a test case for that sorting and getData. Can anyone please tell me some solution for testing that functionality My code is as given below jasmine test case describe('Testing Controllers', function() { describe('Testing WorkController Controller', function() { var WorkController, $scope; beforeEach(module('wsd')); beforeEach(inject(function($controller, $rootScope) { $scope =

Pagination not working after loading JSON data on Ng-Table

对着背影说爱祢 提交于 2019-12-05 17:29:16
I followed the example on http://bazalt-cms.com/ for the pagination but using $http.get instead of hard-coding a variable in the controller. $http.get("data.json").success(function(data){ $scope.dataset = data; } I also moved the $scope.tableParams inside the $http.get $http.get("data.json").success(function(data){ $scope.dataset = data; $scope.tableParams = new ngTableParams({ ... } }); and changed the data variable to $scope.dataset total: $scope.dataset.length, // length of data getData: function($defer, params) { $defer.resolve($scope.dataset.slice((params.page() - 1) * params.count(),

ng-table filter with nested properties

柔情痞子 提交于 2019-12-05 12:58:49
I have following JSON: [{ "Id": "1", "Data": {"Str1": "Ann", "Str2": "Xenna"} },{ "Id": "2", "Data": {"Str1": "Bob","Str2": "Bobby"}, }] And I created ng-table to display it. I tried to add filter. When I filter by Id everything works as expected (filter is { "Id": "2" } ). But I cannot create proper filter do Str1 and Str2 fields. I already tried: { "Str1": "A" } { "Data.Str1": "A" } { "Data['Str1']": "A" } but above options does not work. Example of my work is here: http://plnkr.co/edit/MyJCqTlgvKLtSP63FYQY?p=preview Update Thanks to @Blackhole I founded that filter {Data: {Str1: 'A'}} works

ngtable : sort and filter on nested object

最后都变了- 提交于 2019-12-05 08:57:39
I have a list of objects to display on a table with ngTable. My object looks like : obj {label:string, nestObj{nestLabel:string } } In my controller I want to allow sorting and filtering on fields 'label' and 'nestObject.label'. I have tried this: $scope.tableParams = new ngTableParams({ page: 1, // show first page count: 10, filter: { label='', nestObj.label='' }, sorting: { label: 'asc', nestObj.label: 'asc' } }, { total: data.length, // length of data getData: function($defer, params) { // use build-in angular filter var filteredData = params.filter() ? $filter('filter')(data, params.filter

How to bind title attribute value in ng-table

穿精又带淫゛_ 提交于 2019-12-05 03:14:33
I am using ng-table to display all values in a table view. Message to be displayed in remarks column (last column of the table) is huge. So, I am displaying few character. When user hovers over the cells I want to show the entire message in a tool-tip. I tried to set it in title attribute, but it's not working. Sample code : http://plnkr.co/edit/I4nCTNhMfxgbBX7Zjxs9?p=preview <table ng-table="tableParams" class="table"> <tr ng-repeat="doc in $data"> <td data-title="'#'" sortable="doc_name">{{$index + 1 }}</td> <td data-title="'Visa Type'" sortable="'type'">{{doc.type}}</td> <td data-title="

ng-table grouping - initialize with rows minimised

∥☆過路亽.° 提交于 2019-12-04 23:49:32
问题 I am using the grouping example of ng-table from http://plnkr.co/edit/CBcbkc Right now the table is initialised with rows expanded, but I would like them to be minimised as I have over 100 records. How can I do this? 回答1: You can set group.$hideRows to true using ngInit: <tbody ng-repeat="group in $groups" ng-init="group.$hideRows = true"> Update I wanted to find a better solution, because the angular docs discourage using ngInit to access scope variables. You can create a controller for each