<ejs-grid id="Grid" dataSource="@ViewBag.DataSource" queryCellInfo="template" toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Dialog"></e-grid-editSettings>
<e-grid-columns>
. . . . . . .
<e-grid-column headerText="Dropdown Button" template="#columnTemplate" width="150"></e-grid-column>
. . . . . . .
</e-grid-columns>
</ejs-grid>
<script type="text/x-jsrender" id="columnTemplate">
<button class="List">Ações</button>
</script>
<script type="text/javascript">
var data = [
{ text: "Visualizar", iconCss: "fa fa-eye" },
{ text: "Editar", iconCss: "fa fa-edit" },
{ text: "Excluir", iconCss: "fa fa-trash" },
{ text: "Liberar p/ Gerência", iconCss: "fa fa-user" },
{ text: "Baixar", iconCss: "fa fa-check" },
{ text: "Estornar", iconCss: "fa fa-mail-reply" },
{ text: "Pagto Parcelado", iconCss: "fa fa-list-ol" }
];
function template(args) {
var ele = args.cell.querySelector('.List');
var drop = new ej.splitbuttons.DropDownButton({
popupHeight: 150,
popupWidth: 200,
items: data
});
drop.appendTo(ele);
}
</script>
|
var flag = true;
var dialogObj;
function dataBound(args) {
if (flag) {
dialogObj = new ej.popups.Dialog({
showCloseIcon: true,
target: document.getElementById('e-content'),
. . . .
visible: false,
header: 'Trip Details',
content: '<div id="Grid2"></div>',
created: function (args) {
var grid = new ej.grids.Grid({
dataSource: data1,
});
grid.appendTo('#Grid2');
}
});
dialogObj.appendTo('#wrapper');
flag = false;
}
}
var data1 = @Html.Raw(Json.Serialize(ViewBag.DataSource));
function template(args) {
var ele = args.cell.querySelector('.List');
var drop = new ej.splitbuttons.DropDownButton({
popupHeight: 150,
popupWidth: 200,
items: data,
select: function (args) {
dialogObj.show();
}
});
drop.appendTo(ele);
} |
Hello,
how can I add click listener to this example? This works fine but clicking the items does nothing. Pls help
Hi Yoab,
Thanks for the update.
In our previous shared sample, while clicking in the dropdown item we have displayed the Grid inside the dialog. Please refer the below video demo for more information.
Video demo: https://www.syncfusion.com/downloads/support/directtrac/general/ze/vdclick-264102676.zip
So, before we start providing solution to your query, we need more information for our clarification. Please share the below details that will be helpful for us to provide better solution.
1) Share your exact requirement scenario with detailed description.
2) Please share the problem scenario in detailed description.
3) Please share your problem scenario in video demonstration format.
Regards,
Rajapandi R