ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Add new row in UI-Grid.

Open debayan31 opened this issue 11 years ago • 4 comments

I am using $scope.gridOptions.data.push({}); to add new row in my grid layout which is appending a new row at the end of data set. But I need to add a row at the top of my current pagination scope.I there any way doing this?

debayan31 avatar Apr 20 '15 12:04 debayan31

The rows by default are in the same order as your data. So $scope.gridOptions.data.unshift({}); should do it. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift

PaulL1 avatar Apr 20 '15 20:04 PaulL1

Thanks Paul for quick reply. But my issue is to add a row in which page I am. If I am in the 2nd page then add new Row will add a row in 2nd page.

debayan31 avatar Apr 21 '15 05:04 debayan31

In that case you'd need to use splice, and need to work out which page you were on and splice at the correct point.

PaulL1 avatar Apr 21 '15 05:04 PaulL1

No further comment for over a month, solution provided that probably resolves the issue. Closing, please re-raise if there is a reliable recreate or more information.

PaulL1 avatar May 16 '15 06:05 PaulL1