angularjs - How can I assign table column headers from a different array in ngGrid? -


my incoming json separated 'headers' , 'rows'. e.g.:

{      "headers":          ["id","timestamp from","blah1","blah2"],     "rows":           [["69517737","1416932540011285849","104220.00","170968251000.000:a000"],         ["69517738","1416932540012427614","119375.00","170968251001.000:a001"]]  } 

i'm wondering how can apply headers columndefs when setting gridoptions...

part of code looks this:

$scope.tableheaders = res.headers; $scope.tabledata = res.rows; //then... $scope.gridoptions = {      data: 'tabledata'//, columndefs: 'tableheaders' }; 

the rows load fine, if uncomment columndefs, doesn't work. tried directly adding $scope.tableheaders columndefs. idea if possible add columndefs basic array above, or have manipulate header data object first? example in documentation shows array objects. not sure how manipulate header array if seemingly needs column header refs begin with: {field:'name', displayname:'name'}. maybe there's way... i'll keep digging, appreciate thoughts on matter...

btw can't change format of json. think idea of separating headers rows reduce size of json, return thousands of rows potentially.

you can try that:

<div ui-grid="{ data:(ngmodel.contracts ? ngmodel.contracts : []), columndefs: $parent.gridoptions.contractgrid }"> </div>


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -