Shripad Bhat
Shripad Bhat

Reputation: 2453

Unable to assign type from data, so defaulting to string in angular ui-grid

Below is my code and getting warnings as "Unable to assign type from data, so defaulting to string"

vm.usersGrid = {
    enableRowSelection: true,
    multiSelect: true,
    data: "vm.users",
    columnDefs: [
        {field: 'id', visible: false, displayName: 'UserId'},
        {field: 'email', displayName: 'User Name'},
        {field: 'countries', displayName: 'Country'},
        {field: 'status', displayName: 'Status'},
    ]
};

Upvotes: 4

Views: 1735

Answers (1)

c0bra
c0bra

Reputation: 3012

That warning has been removed as of RC22. It simply indicates that the Grid can't tell what the data type of your column is based on the first row, so it's defaulting to type "string".

You can set a specific type by using the "type" property in your column defs. The main concern for knowing column types is for properly sorting data. You can read about that here: http://ui-grid.info/docs/#/tutorial/102_sorting

Upvotes: 5

Related Questions