Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
144713 | May 18,2019 05:02 PM UTC | May 23,2019 05:11 AM UTC | Angular - EJ 2 | 7 |
![]() |
Tags: Grid |
<ejs-grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [editSettings]='editSettings' (actionComplete)='actionComplete($event)' [toolbar]='toolbar'>
<e-columns>
. . . . . .
</e-columns>
</ejs-grid>
|
actionComplete(args){
if (args.requestType === 'add' || args.requestType === 'beginEdit') {
let button = document.createElement('button');
button.setAttribute('class', 'e-control e-btn e-lib e-flat');
button.setAttribute('cssClass', 'e-flat');
button.innerHTML = 'Copy';
args.dialog.element.querySelector('.e-footer-content').append(button);
button.addEventListener('click', function (e) {
alert("custom button") // you customize as per your need
})
}
}
|
actionComplete(args) {
if (args.requestType === 'add' || args.requestType === 'beginEdit') {
var button = document.createElement('button');
button.setAttribute('class', 'e-control e-btn e-lib e-flat');
button.setAttribute('cssClass', 'e-flat');
button.innerHTML = 'Copy';
button.innerHTML = 'Copy';
button.type="button"; // need to apply type as button to prevent page reload
// insert the button before the ship country field
#gridShipCountry' => grid id+ field name
args.dialog.element.getElementsByTagName('tbody')[0].insertBefore(button, args.dialog.element.querySelector('#gridShipCountry').closest('tr'))
button.addEventListener('click', function (e) {
alert("custom button") // you can do as per your requirement
})
}
}
|
actionComplete(args) {
if (args.requestType === 'add' || args.requestType === 'beginEdit') {
. . . . .
button.addEventListener('click', function (e) {
// get dropdown instance and assign ShipCountry value to dataSource and value property of country dropdown
dialog.element.querySelector('#gridCountry').ej2_instances[0].dataSource = [{ 'Country': dialog.element.querySelector('#gridShipCountry').value }];
dialog.element.querySelector('#gridCountry').ej2_instances[0].value = dialog.element.querySelector('#gridShipCountry').value;
}.bind(this))
}
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.