4

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'},
    ]
};
1
  • you can use typeOf to check whether it is a object or string or anyother type Commented Jun 24, 2015 at 13:38

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

3 Comments

I still get the warning when running v3.0.0-rc.22. Is it removed in the next version?
@miguelr Dang, you're right. Very sorry, somehow the change didn't make it into RC 22. Yes it will be in RC 23 and is already in the unstable tip of master.
@c0bra Why isn't "type" mentioned in the documentation ?... Nevermind, found it! here ui-grid.info/docs/#/api/ui.grid.class:GridOptions.columnDef

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.