// Grid’s column template
<script id="template" type="text/x-template">
<div class="custom-dialog"></div>
</script>
<script>
// Grid’s dataBound event function
function dataBound(args) {
// Get all the div elements rendered inside the cell using column template
var dialogElements = this.element.querySelectorAll('.custom-dialog');
var i = 0;
while (i < dialogElements.length) {
var dialog = new ej.popups.Dialog({
// Dialog content
content: 'This is a Dialog with content',
// The Dialog shows within the target which in this case is the row cell
target: dialogElements[i].parentElement,
// Dialog width
width: '150px'
});
// Render initialized Dialog and append it to the div element
dialog.appendTo(dialogElements[i]);
i++;
}
}
</script> |
while (i < dialogElements.length) {
var dialog = new ej.popups.Dialog({
// Dialog content
content: 'This is a Dialog with content',
// The Dialog shows within the target element
target: dialogElements[i].parentElement,
// The Dialog header can be set here
header: 'Dialog',
// Dialog width
width: '150px'
}); |
<script id="template" type="text/x-template">
<div class="custom-dialog">${ShipName}</div>
</script>
<script>
function dataBound(args) {
var dialogElements = this.element.querySelectorAll('.custom-dialog');
var i = 0;
while (i < dialogElements.length) {
var dialog = new ej.popups.Dialog({
// Column value defined inside the template element is set as the dialog content
content: dialogElements[i].innerText,
.
.
});
// Template element’s innerText is cleared
dialogElements[i].innerText = "";
// Render initialized Dialog
dialog.appendTo(dialogElements[i]);
i++;
}
}
</script> |