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

Creating ng-grids dynamically #1294

Closed
ivanpg opened this issue Jul 12, 2014 · 3 comments
Closed

Creating ng-grids dynamically #1294

ivanpg opened this issue Jul 12, 2014 · 3 comments

Comments

@ivanpg
Copy link

ivanpg commented Jul 12, 2014

I have a problem creating ng-grids dynamically:

The next function loops through each element of $scope.dataSparqlResponses (each element is an array of data) and put the value of the iteration in $scope.dataSparqlAux. And $scope.dataSparqlAux is the variable used in the grids (data input). The problem is that in each iteration this variable ($scope.dataSparqlAux) is reassigned, so in the template I can only see the last grid with data.

controller.js
problema1

template.html
problema2

is possible to do something like this?
problema3

How can I fix this to create grids and display information dynamically?

Regards and thanks for your time.

EDIT: here a plunker with a sample of the problem http://plnkr.co/edit/zYtuMW4TKW053YoDY0kg?p=preview

@Goodzilla
Copy link

The part with "data: 'dataSparqlAux" is only a reference to that variable. You're not storing the data into your grid at that moment.
You'd have to create a new variable for each sub-document and add it as a reference.

Here's a dirty hack that works : http://jsbin.com/yixom/5/watch?js,output

@ivanpg
Copy link
Author

ivanpg commented Jul 17, 2014

Thanks. This is perfect. I'm new with javascript and Angularjs. And with this solution, I can follow with my project. Thanks again.

@c0bra c0bra closed this as completed Jul 17, 2014
@vishnumvn
Copy link

http://jsbin.com/yixom/5/watch?js,output
I can't able to open the solution. please paste in here.

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

4 participants