Hello,
How to order grid toolbar based on order of appearance of toolbar array? Below are my toolbar array, from the array, the search box should appear first, excel report second and so on. But if you see my capture below, it does not follow the toolbar array appearance.
toolbar: [
'Search', 'ExcelExport',
{ type: 'Separator' },
{ text: 'Add', tooltipText: 'Add', prefixIcon: 'e-add', id: 'AddCustom' },
{ text: 'Edit', tooltipText: 'Edit', prefixIcon: 'e-edit', id: 'EditCustom' },
{ text: 'Delete', tooltipText: 'Delete', prefixIcon: 'e-delete', id: 'DeleteCustom' },
{ type: 'Separator'},
{ text: 'Details', tooltipText: 'Details', prefixIcon: '', id: 'DetailsCustom' },
{ type: 'Separator' },
{ text: 'Confirm Order', tooltipText: 'Confirm Order', prefixIcon: '', id: 'ConfirmOrder' },
{ text: 'Cancel Order', tooltipText: 'Cancel Order', prefixIcon: '', id: 'CancelOrder' },
{ type: 'Separator' },
{ text: 'Receipt Lookup', tooltipText: 'Purchase Receipt', prefixIcon: '', id: 'ReceiptLookup' },
{ text: 'Generate Confirm Receipt', tooltipText: 'Generate Confirm Receipt', prefixIcon: '', id: 'ConfirmReceipt' },
{ text: 'Generate Draft Receipt', tooltipText: 'Generate Draft Receipt', prefixIcon: '', id: 'DraftReceipt' },
{ type: 'Separator' },
],
How is the best way to order the toolbar appearance?
Best regards,
Ismail
[index.js]
var grid = new ej.grids.Grid({
-----
toolbar: [
'Search',
'ExcelExport',
{ type: 'Separator' },
{ text: 'Add', tooltipText: 'Add', prefixIcon: 'e-add', id: 'AddCustom' },
-----
],
----
toolbarClick: toolbarClick,
dataBound: dataBound
});
grid.appendTo('#Grid');
function toolbarClick(args) {}
function dataBound(args) {
// change the position of left toolbar items
grid.element.querySelector('.e-toolbar-left').style.left =
grid.element.querySelector('.e-toolbar-right').getBoundingClientRect().width + 'px';
}
[index.html]
<style>
.e-toolbar .e-toolbar-items.e-tbar-pos .e-toolbar-right {
left: 0;
}
</style>
|
Hello Rajapandiyan,
Thank you for your update. Your solution successfully move the search box become the first on the left:
Thank you for your kind help and support.
Best regards,
Ismail
Hello Rajapandiyan,
After testing to another grid with overflowMode set to 'MultiRow', your provided solution did not work. The searchbox did not move to the first left most of the grid:
Could you please help me again with this
Thanks in advance
Best regards,
Ismail
[index.js]
function dataBound(args) {
grid.toolbarModule.element.ej2_instances[0].overflowMode = 'MultiRow';
var toolbarrightele = grid.element.querySelector('.e-toolbar-right');
toolbarrightele.parentElement.insertBefore( toolbarrightele, toolbarrightele.parentElement.children[0] );
setTimeout(() => {
if (grid.element.querySelector('.e-toolbar-left').style.marginLeft) {
grid.element.querySelector('.e-toolbar-left').style.marginLeft = grid.element.querySelector('.e-toolbar-right').getBoundingClientRect() .width + 'px';
}
}, 100);
}
|
Hello Rajapandiyan,
Thank you for your update info. Your provided solution can solve my problem:
Thank you for your kind support.
Best regards,
Ismail