AngularJS: ngTable with json data: filtering and sorting does not work -


I am trying to populate data from a REST webservice in the table using ngTable. Data are being shown, but they are neither fit nor filterable. Filtering always gives blank list.

Here is a link to the API that I am referring to:

JS:

  $ Scope.dataInstances = []; $ Scope.getDataInstances = function () {$ http ({method: 'GET', url: '/ rest / v1 / data / instances', header: {"authorization": "Basic" + btoa ("USERNAME" + " : "+" PASSWORD ")}}}. Svitt (function (data, position) {$ scope.dataInstances = data; $ scope.tableParams.reload (); // just some logging console.log (JSON.stringify (data) Terror (function (data, position) {alert ("error:" + status);});} $ $ scope.tableParams = new ngTableParams ({pages: 1, // show first page count: 10, // filter count per page: {}, sorting: {date: 'ASC' / / initial sorting}}, {total: $ scope.dataInstances.length, // data length getData: function ($ defer, params ) {// Usage Angle filter created in the industry var filteredData = params.filter ()? $ Filter ('filter') ($ range data instances, parameters.filter ()): $ scope.dataInstances; var ordered data = params. $) $ Filter ('Order By') (Filtered Data, Parameters. Order By ()): $ scope.dataInstances; params.total (ordered data .length); // Total set $ for Recall Endorsing Defer.resolve (ordered data. Salis (params (page) - 1) * paramount coat (), params.page () * params coat ())); }});   

HTML:

  & lt; Div ng-controller = "myController" ng-init = "getDataInstances ()" & gt; & Lt; Table ng-table = "table param" show-filter = "true" class = "table-table-condensed" & gt; & Lt; Tr ng-repeat = "data instances in data instances" & gt; & Lt; Td data-title = "'name' 'sort =' 'name' 'filter =" {' name ':' text '} "& gt; {{dataInstance.name}}  & lt ; Td data-title = "'date' 'sort =' 'date' 'filter =" {' date ':' text '} "& gt; {{DataInstance.date | Date: 'DDMMYY HH: MM'}} & lt; / Td> & Lt; Td data-title = "type" sort = "'type'" filter = "{'type': 'text'}" & gt; {{dataInstance.type}}  & lt; / TR & gt; & lt; / table & gt; & lt; / div & gt;   

Do you have an indication of this work? Trying different possible solutions - No more work done - like:

  • Thanks in advance!

    Edit :

    Working together in the end Angular 1.2.20 and ng-table 0.3.1 .

    B

    Thank you for their efforts!

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -