Open mrpiotr-dev opened 6 years ago
HI, How to Add a column to a table with AngularJS ?
tried to add a column if a button is pressed, but with no success. I made a example with my problem. I would be very thankful if someone could help me with this problem.
$scope.addValue = function() { $scope.headers.push('new header'); var users = 5; for(var i = 0; i < users; i++) { var rowData = []; for (var j = 0; j < 1; j++) { rowData.push('data i=' + i + ' j=' + j) } $scope.data.push(rowData); } }; Please Help!!
Hi @Akash123-1
If you define your data as an object and use columns then you need to call updateSettings > columns (with larger amount fo objects) to add a column. If your data is an array of arrays and you do not need the columns you can call alter method.
@jnjagtap commented on Mon Jul 02 2018
how to add comment column to table a and previous comments should remain unchanged .in angularjs using handsontable
@AMBudnik commented on Mon Jul 02 2018
Hi @jnjagtap
Can you share a draft? I am not sure what you would like to achieve. And just to confirm - are you using the AngularJS, not Angular 2+?
@jnjagtap commented on Mon Jul 02 2018
yes i am using angularjs. can we add comment to whole table?
in this at last there should be colunn comment and whenver data updated but comment should e remained as it is .
@jnjagtap commented on Mon Jul 02 2018
I could able to create tables using nghandsontable syntax. But I want to add some comment to table . So that while opening table definition from catalog, the same comment should be present.
@AMBudnik commented on Tue Jul 03 2018
Hi @jnjagtap
Comments are an array of objects provided via
cell
propertyyou can add comment to each cell, you just need to define then in the array. If user adds a comment manually you should also push it to the array of comments for further use. Without it the comment will be lost after you load the data again.
@jnjagtap commented on Tue Jul 03 2018
but i don't want add comments to cell .i want to add comment column in table where i can read comments even if data updated or page is refreshed comments should remain as it is.
@AMBudnik commented on Tue Jul 03 2018
We do not have any option like
comment column
, If you think of a column that is editable and you want the user to post there anything and then remain the data after you load yours from the database you need to pass this data to the server viaafterChange
hook.Sorry if I do not get the idea.