ag-grid + angularJS header and cells editable by the user












0














I just start using the ag-grid library with angularJS to display some tabular data in my application. The thing now is that I want the user to be able to alter the header value of each column like as he/she can edit the cells within a column when we enable the editable attribute. While searching for a solution I realized that there is no default way to turn the header into an editable element. So I was wondering which are my alternatives.



One thought of mine was to add to each header an edit button and when clicked a modal window to pop up with the corresponding input fields of the header and its column's cell values. In this case, the editable attribute is not going to be used because the edit of the cells will be conducted within the modal. Something like that but instead for the row, the button should be in each header.



So which are the ways that I can achieve something like that? I read about header template but couldn't really found any straightforward way to approach it.



Any ideas/hints or other alternatives are welcome.










share|improve this question






















  • What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
    – un.spike
    Nov 19 '18 at 20:10










  • I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
    – J. Doe
    Nov 19 '18 at 20:52










  • have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
    – un.spike
    Nov 19 '18 at 21:05










  • No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
    – J. Doe
    Nov 19 '18 at 21:36
















0














I just start using the ag-grid library with angularJS to display some tabular data in my application. The thing now is that I want the user to be able to alter the header value of each column like as he/she can edit the cells within a column when we enable the editable attribute. While searching for a solution I realized that there is no default way to turn the header into an editable element. So I was wondering which are my alternatives.



One thought of mine was to add to each header an edit button and when clicked a modal window to pop up with the corresponding input fields of the header and its column's cell values. In this case, the editable attribute is not going to be used because the edit of the cells will be conducted within the modal. Something like that but instead for the row, the button should be in each header.



So which are the ways that I can achieve something like that? I read about header template but couldn't really found any straightforward way to approach it.



Any ideas/hints or other alternatives are welcome.










share|improve this question






















  • What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
    – un.spike
    Nov 19 '18 at 20:10










  • I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
    – J. Doe
    Nov 19 '18 at 20:52










  • have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
    – un.spike
    Nov 19 '18 at 21:05










  • No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
    – J. Doe
    Nov 19 '18 at 21:36














0












0








0







I just start using the ag-grid library with angularJS to display some tabular data in my application. The thing now is that I want the user to be able to alter the header value of each column like as he/she can edit the cells within a column when we enable the editable attribute. While searching for a solution I realized that there is no default way to turn the header into an editable element. So I was wondering which are my alternatives.



One thought of mine was to add to each header an edit button and when clicked a modal window to pop up with the corresponding input fields of the header and its column's cell values. In this case, the editable attribute is not going to be used because the edit of the cells will be conducted within the modal. Something like that but instead for the row, the button should be in each header.



So which are the ways that I can achieve something like that? I read about header template but couldn't really found any straightforward way to approach it.



Any ideas/hints or other alternatives are welcome.










share|improve this question













I just start using the ag-grid library with angularJS to display some tabular data in my application. The thing now is that I want the user to be able to alter the header value of each column like as he/she can edit the cells within a column when we enable the editable attribute. While searching for a solution I realized that there is no default way to turn the header into an editable element. So I was wondering which are my alternatives.



One thought of mine was to add to each header an edit button and when clicked a modal window to pop up with the corresponding input fields of the header and its column's cell values. In this case, the editable attribute is not going to be used because the edit of the cells will be conducted within the modal. Something like that but instead for the row, the button should be in each header.



So which are the ways that I can achieve something like that? I read about header template but couldn't really found any straightforward way to approach it.



Any ideas/hints or other alternatives are welcome.







angularjs ag-grid






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 19 '18 at 19:41









J. DoeJ. Doe

31517




31517












  • What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
    – un.spike
    Nov 19 '18 at 20:10










  • I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
    – J. Doe
    Nov 19 '18 at 20:52










  • have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
    – un.spike
    Nov 19 '18 at 21:05










  • No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
    – J. Doe
    Nov 19 '18 at 21:36


















  • What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
    – un.spike
    Nov 19 '18 at 20:10










  • I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
    – J. Doe
    Nov 19 '18 at 20:52










  • have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
    – un.spike
    Nov 19 '18 at 21:05










  • No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
    – J. Doe
    Nov 19 '18 at 21:36
















What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
– un.spike
Nov 19 '18 at 20:10




What you are trying to achieve? Header - just a name of the field in data-object which is passed by you via rowData or setData. For what you need to modify a header? should it change the structure then?
– un.spike
Nov 19 '18 at 20:10












I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
– J. Doe
Nov 19 '18 at 20:52




I want, the user to be able to change the structure. Let's say for example that each row describes a linear model. The first column describes the first parameter, the second column the second parameter etc. So I want the user to be able to set the name of that parameter as well as the value of it for each model.
– J. Doe
Nov 19 '18 at 20:52












have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
– un.spike
Nov 19 '18 at 21:05




have you thought about how you will update the structure inside ag-grid? I mean, ok, the case is clear for now, but you wanna to combine it in one component and actually I don't think its good idea.
– un.spike
Nov 19 '18 at 21:05












No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
– J. Doe
Nov 19 '18 at 21:36




No. I didn't thought it and that's why I asked here. Maybe there was something that I missed from the documentation. Combine what with a component? How do you mean that?
– J. Doe
Nov 19 '18 at 21:36












1 Answer
1






active

oldest

votes


















0














Make a service which have an array as DataSet of your grid, and provide it with handlers for the events of a CRUD in the same service. Inject the service into the controller of your modal and view of the grid. After that, call the object gridDataSetadd,remove,update who is in the service, then $digest do the rest of the work once DataSet will be modified.



UPDATE, answering the comment



Inject your service into your controller:



For .ts



static $inject = ['$scope','YourService'];
constructor($scope, userService: YourService) {
this.userService.getSomething();
}


For .js



.controller('YourCtrl', ['$scope', 'YourService', function ($scope, YourService) {
$scope.someVar = YourService.someVar;
}])





share|improve this answer























  • Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
    – J. Doe
    Nov 20 '18 at 7:06













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381552%2fag-grid-angularjs-header-and-cells-editable-by-the-user%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Make a service which have an array as DataSet of your grid, and provide it with handlers for the events of a CRUD in the same service. Inject the service into the controller of your modal and view of the grid. After that, call the object gridDataSetadd,remove,update who is in the service, then $digest do the rest of the work once DataSet will be modified.



UPDATE, answering the comment



Inject your service into your controller:



For .ts



static $inject = ['$scope','YourService'];
constructor($scope, userService: YourService) {
this.userService.getSomething();
}


For .js



.controller('YourCtrl', ['$scope', 'YourService', function ($scope, YourService) {
$scope.someVar = YourService.someVar;
}])





share|improve this answer























  • Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
    – J. Doe
    Nov 20 '18 at 7:06


















0














Make a service which have an array as DataSet of your grid, and provide it with handlers for the events of a CRUD in the same service. Inject the service into the controller of your modal and view of the grid. After that, call the object gridDataSetadd,remove,update who is in the service, then $digest do the rest of the work once DataSet will be modified.



UPDATE, answering the comment



Inject your service into your controller:



For .ts



static $inject = ['$scope','YourService'];
constructor($scope, userService: YourService) {
this.userService.getSomething();
}


For .js



.controller('YourCtrl', ['$scope', 'YourService', function ($scope, YourService) {
$scope.someVar = YourService.someVar;
}])





share|improve this answer























  • Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
    – J. Doe
    Nov 20 '18 at 7:06
















0












0








0






Make a service which have an array as DataSet of your grid, and provide it with handlers for the events of a CRUD in the same service. Inject the service into the controller of your modal and view of the grid. After that, call the object gridDataSetadd,remove,update who is in the service, then $digest do the rest of the work once DataSet will be modified.



UPDATE, answering the comment



Inject your service into your controller:



For .ts



static $inject = ['$scope','YourService'];
constructor($scope, userService: YourService) {
this.userService.getSomething();
}


For .js



.controller('YourCtrl', ['$scope', 'YourService', function ($scope, YourService) {
$scope.someVar = YourService.someVar;
}])





share|improve this answer














Make a service which have an array as DataSet of your grid, and provide it with handlers for the events of a CRUD in the same service. Inject the service into the controller of your modal and view of the grid. After that, call the object gridDataSetadd,remove,update who is in the service, then $digest do the rest of the work once DataSet will be modified.



UPDATE, answering the comment



Inject your service into your controller:



For .ts



static $inject = ['$scope','YourService'];
constructor($scope, userService: YourService) {
this.userService.getSomething();
}


For .js



.controller('YourCtrl', ['$scope', 'YourService', function ($scope, YourService) {
$scope.someVar = YourService.someVar;
}])






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 20 '18 at 17:39

























answered Nov 19 '18 at 22:52









SiegSieg

336211




336211












  • Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
    – J. Doe
    Nov 20 '18 at 7:06




















  • Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
    – J. Doe
    Nov 20 '18 at 7:06


















Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
– J. Doe
Nov 20 '18 at 7:06






Excuse, but how am I going to inject the service to the view of the grid? Can you give me an example?
– J. Doe
Nov 20 '18 at 7:06




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381552%2fag-grid-angularjs-header-and-cells-editable-by-the-user%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

ts Property 'filter' does not exist on type '{}'

mat-slide-toggle shouldn't change it's state when I click cancel in confirmation window