- Home
- Forum
- Angular - EJ 2
- Can the add button display in the grid record's bottom line ?
Can the add button display in the grid record's bottom line ?
Hi,
I want to add a button always in the grid record's bottom line, follow the bellow picture:
Can you do it ?
SIGN IN To post a reply.
3 Replies
AG
Ajith Govarthan
Syncfusion Team
December 4, 2020 02:51 PM UTC
Hi lorryl,
Thanks for contacting Syncfusion support.
Query: I want to add a button always in the grid record's bottom line, follow the bellow picture:Can you do it ?
Based on your query you want to add button at the bottom of the content rows and need to perform the add operation. So, we have prepared sample and in that sample we have added the button at the end of the content rows using the dataBound event.
For your convenience we have attached the sample so please refer the sample for your reference.
Code Example:
|
App.component.ts
dataBound() {
let buttonEle = document.createElement("button");
buttonEle.innerText = "Add Record";
addClass([buttonEle], ["e-btn", "e-add", "e-icons"]); // add classList here
buttonEle.addEventListener("click", this.buttonClick.bind(this));
this.grid.getContent().appendChild(buttonEle); // append the button element to the content.
}
buttonClick(e) {
this.grid.addRecord();
} |
Please get back to us if you need further assistance.
Regards,
Ajith G.
LO
lorryl
December 7, 2020 03:04 AM UTC
Hi,
Thanks for your reply. Can you put the button in the red places? The button is so far for user to add now.
AG
Ajith Govarthan
Syncfusion Team
December 7, 2020 12:37 PM UTC
Hi lorryl,
Sorry for the inconveniences caused.
Query: Thanks for your reply. Can you put the button in the red places? The button is so far for user to add now.
Based on your query you want to add the add button at the bottom of the content rows and need to perform the add operation. So, we have prepared sample and in that sample, we have added the button at the end of the content rows instead of content div element using the dataBound event.
For your convenience we have attached the sample so please refer the sample for your reference.
Code Example:
|
App.component.ts
dataBound() {
if (this.grid.getContentTable().querySelector("#CustBtn")) {
this.grid .getContentTable().querySelector("#CustBtn").remove();
}
let buttonEle = document.createElement("button");
buttonEle.innerText = "Add Record";
buttonEle.id = "CustBtn";
addClass([buttonEle], ["e-btn", "e-add", "e-icons"]);
buttonEle.addEventListener("click", this.buttonClick.bind(this));
this.grid.getContentTable().appendChild(buttonEle);
} |
Please get back to us if you need further assistance.
Regards,
Ajith G.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
LO lorryl
- Dec 3, 2020 10:40 AM UTC
- Dec 7, 2020 12:37 PM UTC