Open anusharshankar opened 7 years ago
I can confirm this issue.
Here's an example of my controller:
var app = angular.module("myApp", ["ngTable", "ngResource", "ui.bootstrap"]);
(function() {
app.controller("demoController", demoController);
demoController.$inject = ["NgTableParams", "$resource"];
function demoController(NgTableParams, $resource) {
var self = this;
var Api = $resource("/api/reports/getdata");
self.cols = [
{ field: "senha", title: "Senha", filter: { senha: "text" }, sortable: "senha", show: true },
{ field: "chequeprenda", title: "Cheque Prenda", sortable: "chequeprenda", show: true },
{ field: "loja", title: "Loja", sortable: "loja", show: false },
{ field: "autor", title: "Autor", filter: { autor: "text" }, sortable: "autor" , show: true }
];
self.tableParams = new NgTableParams({}, {
getData: function (params) {
return Api.get(params.url()).$promise.then(function (data) {
params.total(data.Paging.TotalRecordCount);
return data.Data;
});
}
});
}
})();
And the View:
<div ng-app="myApp">
<div ng-controller="demoController as demo">
<table ng-table-dynamic="demo.tableParams with demo.cols" class="table table-condensed table-bordered table-striped">
<tr ng-repeat="row in $data ">
<td ng-repeat="col in $columns">{{row[col.field]}}</td>
</tr>
</table>
</div>
</div>
No sorting options appear and the filter does not respond to typing. Using Angular 1.4.2 and cdn ng-table
My code is the same as yours@nunogrocha, but it can't be rendered
I am obtaining my column headers dynamically from JSON data and they vary from Object to object. Based on the obtained data I am trying to recreate the table accordingly. I was able to get pagination in place but cannot get filtering or sorting to work. Object 1 has header titles : Name, Status, Diameter, units Object 2 has header titles: Name, Status, Volume, Diameter, Pressure, units. so on so forth for about 100 different Objects like that.