javascript - Cannot read property 'then' of undefined in MdDataTable -
i'm using mddatatable display data want retrieve server. want use pagination. angular code:
$scope.paginatorcallback = function(page, pagesize){ var offset = (page-1) * pagesize; mysrv.getdata.get( { offset: offset, pagesize: pagesize }, function (data) { return { results: data.list, totalresultcount: data.totalresults } }, function (error) { alert(error); } ) }
this html code:
<mdt-table paginated-rows="{isenabled: true, rowsperpagevalues: [5,10,20,50]}" mdt-row-paginator="paginatorcallback(page, pagesize)" mdt-row-paginator-error-message="error happened during loading nutritions." mdt-row="{ 'table-row-id-key': 'fields.item_id', 'column-keys': [ 'fields.item_name', 'fields.nf_calories', 'fields.nf_total_fat', 'fields.nf_total_carbohydrate', 'fields.nf_protein', 'fields.nf_sodium', 'fields.nf_calcium_dv', 'fields.nf_iron_dv' ], }"> <mdt-header-row> <mdt-column align-rule="left">dessert (100g serving)</mdt-column> <mdt-column align-rule="right">calories</mdt-column> <mdt-column align-rule="right">fat (g)</mdt-column> <mdt-column align-rule="right">carbs (g)</mdt-column> <mdt-column align-rule="right">protein (g)</mdt-column> <mdt-column align-rule="right">sodium (mg)</mdt-column> <mdt-column align-rule="right">calcium (%)</mdt-column> <mdt-column align-rule="right">iron (%)</mdt-column> </mdt-header-row> </mdt-table>
it call server , retrieve data correctly (so not problem of server), can't see data in html , have error in console:
angular.js:13708 typeerror: cannot read property 'then' of undefined @ mdtajaxpaginationhelper.fetchpage (http://localhost/vendor/mddatatable/md-data-table.js:629:17) @ new mdtajaxpaginationhelper (http://localhost/vendor/mddatatable/md-data-table.js:586:18) @ object.getinstance (http://localhost/vendor/mddatatable/md-data-table.js:677:24) @ inittablestorageserviceandbindmethods (http://localhost/vendor/mddatatable/md-data-table.js:208:85) @ new mdttablecontroller (http://localhost/vendor/mddatatable/md-data-table.js:197:17) @ object.invoke (http://localhost/vendor/angular/angular.js:4709:19) @ $controllerinit (http://localhost/vendor/angular/angular.js:10234:34) @ nodelinkfn (http://localhost/vendor/angular/angular.js:9147:34) @ http://localhost/vendor/angular/angular.js:9553:13 @ processqueue (http://localhost/vendor/angular/angular.js:16170:28) undefined
Comments
Post a Comment