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

Consider supporting Data.Collections from arrays #28

Open
jamescasbon opened this issue Aug 13, 2011 · 0 comments
Open

Consider supporting Data.Collections from arrays #28

jamescasbon opened this issue Aug 13, 2011 · 0 comments

Comments

@jamescasbon
Copy link

Currently, in order to create a Data.Collection, you need to pass a list of key, value pairs like so:

var  data = { properties: {...}, items: {...} };

Since this is for tabular style data, you should consider allowing a spec of the form:

var data = { properties: {...}, items: [...] };

This almost works at the moment, except Data.Object presumes a node has a string id in order to do things like ( https://github.com/michael/data/blob/master/data.js#L969 ):

this.html_id = id.replace(/\//g, '_');

Is it really required that all ids are strings? If so, you could support it by using key.toString when you create the graph at https://github.com/michael/data/blob/master/data.js#L1555

Also, would is it not natural to expect a Data.Collection to support index based lookup, such as at?

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

1 participant