Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No mechanism to bind column to the row object itself #5359

Closed
StrangelyTyped opened this issue Apr 26, 2016 · 0 comments
Closed

No mechanism to bind column to the row object itself #5359

StrangelyTyped opened this issue Apr 26, 2016 · 0 comments

Comments

@StrangelyTyped
Copy link
Contributor

Occasionally I find I need a grid with just one column, and often I find that the data I need to bind to it is just an array of strings. I've tried a few different things and haven't been able to find a mechanism to populate a grid from an array of strings without reformatting the data into an array of objects (each with a single property - the original string for that row).

Attempting to do so results in a grid with the correct number of rows but no content in the specified column, as you can see in my example plunk here

Omitting the field column property altogether or providing an empty value, or passing other possible values like 'row' result in an empty cell.

The ui-grid documentation says that the 'field' property "Should be an angular expression that evaluates against grid.options.data array element." and to "See the angular docs on binding expressions.". The angular docs specify this in a section on the expressions page - "It is possible to access the context object using the identifier this", however using 'this' as the field value does not appear valid either, resulting in an empty cell as well.

As a result I have yet to find a mechanism for using an array of strings as source data for a UI Grid. I'd like to request that such functionality be added, possibly through a special value in the column's field property ('this' or empty string would appear to be good candidates, the latter being my preference). If such a mechanism already exists and I simply haven't found it then I'd like to request that the documentation be updated to provide examples of how this is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants