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

Adding items dynamically #1

Open
stvogel opened this issue Mar 18, 2015 · 1 comment
Open

Adding items dynamically #1

stvogel opened this issue Mar 18, 2015 · 1 comment

Comments

@stvogel
Copy link

stvogel commented Mar 18, 2015

Thanks for this great angular-grid. I really like it.

I just tried to add an item dynamically by just adding it to the items-array. That works like a charm.
But the grid is not immediately redrawn, so that the new item does not show up only until I force a redraw by moving the other items or resizing.
How can I issue a "redraw" after changing the items-array?

Thanks again and kind regards
Stefan

@SekibOmazic
Copy link
Owner

You could only have a button like this:

<a class="btn btn-primary" ng-click="ctrl.addWidget()">Add Widget</a>

in simple.view.html and following in SimpleCtrl:

this.addWidget = function() {
  this.standardItems.push({
    sizeX: 1,
    sizeY: 1,
    row: 0,
    col: 0,
    name: 'New Widget'
  });
};

and this should work.

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