daniel-nagy / md-data-table

Material Design Data Table for Angular Material
MIT License
1.9k stars 520 forks source link

progress bar not stable #627

Open tim7004 opened 6 years ago

tim7004 commented 6 years ago

Dear all, Below is my code:

function successGetData(data) {
    $scope.myData = data;
  }

  $scope.getUnMatchedBets = function () {
    var resource=$resource('http://example.com/content/testing_data.json',{},{'get':{method:'GET',isArray:true}})
    $scope.promise = resource.get({}, successGetData).$promise;
  };

And the testing_data.json have about 2000+ records like:

[
 {
    "id": "59edac10fc7b1f45bb314977",
    "test_id": 1030000093877,
    "selection": "Selection_0",
    "payment": 7212,
    "risk": 17356,
    "price": 1.7963,
    "username": "Frazier Sherman"
  },
  {
    "id": "59edac1054ad8ba31502a727",
    "test_id": 1030000093878,
    "selection": "Selection_1",
    "payment": 9461,
    "risk": 19677,
    "price": 1.4711,
    "username": "Leigh Sharp"
  },
.....
]

I try to load and show all the data in the table, and it works.It takes about 5s to load all data. But I found that the progress bar has some problems. The progress bar almost reaches the end, it will go back again. It will keep doing the same action in this 5s.

Is it any wrong in my code? I simple using the sample html in the table.

Thank you.

adsa95 commented 6 years ago

If you look in the source template (src/templates/md-table-progress.html), you can see that this is because this libary uses the 'indeterminate' mode of the progress bar, which means it's only loading or not loading and doesn't update the progress bar to show the progress of the operation: <md-progress-linear ng-show="deferred()" md-mode="indeterminate"></md-progress-linear>

There is nothing wrong with your code, it's just the way it works when using this library.

You can compare the different modes that is available in Angular Material in their documentation

tim7004 commented 6 years ago

Thank you adsa95~ I found that it is because of ngRepeat rendering of large set of data. So it make the progress bar slow