gm2008
gm2008

Reputation: 4325

ui-grid columnDefs error

I have a general purpose angular controller, which displays a grid view of data. I use it in multiple places of the page by providing different data.

I want to customize the column definition in html using ng-init like this:

 <div ng-controller="DataTableController" ng-init="setColDefs([{field:'c_partno', displayName:'Part No',width:'60px'}, {field:'c_owner',displayName:'Owner',width:'60px'}])">
    <div ui-grid="gridOptions" class="data-table"></div>
 </div>

However, I get Error: Cannot parse column width '60px' for column named 'c_partno'.

Very appreciated if anyone can help.

Upvotes: 0

Views: 391

Answers (1)

alicona
alicona

Reputation: 140

You should write width: 60 instead of width: '60px' you can check this on the Documentation, hope it helps.

https://github.com/angular-ui/ui-grid/wiki/Defining-columns

Upvotes: 2

Related Questions