JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › initialize grid with empty dataSource › Reply To: initialize grid with empty dataSource
May 10, 2022 at 10:53 am
#103185
admin
Keymaster
Hi,
Unfortunately, we cannot reproduce this and we will need a complete codepen sample or something similar. Here is our test code based on your last post:
Smart('#grid', class {
get properties() {
return {
sorting: {
enabled: true
},
editing: {
enabled: true,
mode: 'row',
action: 'none',
dialog: {
enabled: true
},
commandColumn: {
visible: true,
position: "near",
dataSource: {
commandColumnMenu: {
visible: true
},
commandColumnRowMenu: {
visible: true
}
}
}
},
locale: 'de',
selection: {
enabled: false,
allowRowSelection: false,
checkBoxes: {
enabled: true
}
},
filtering: {
enabled: true
},
behavior: { allowColumnReorder: true },
onCommand: function (args) {
if (args.name === "commandColumnRowMenuCommand") {
const row = args.details;
const menu = document.getElementById("grid");
args.event.preventDefault();
let contextMenuGridOpenedOn = args.details;
window.numOrdine = contextMenuGridOpenedOn.data.NumeroOrdine;
menu.open(args.event.pageX - 30, args.event.pageY - 80);
args.handled = true;
}
},
dataSource: [],
columns: [
{
label: 'First Name', dataField: 'firstName', filterMenuMode: 'excel'
},
{ label: 'Last Name', dataField: 'lastName' },
{ label: 'Date', dataField: 'date', align: 'right', cellsAlign: 'right', },
{ label: 'Product', dataField: 'productName' },
{ label: 'Quantity', dataField: 'quantity', align: 'right', cellsAlign: 'right', }
]
}
}
});
No errors in the console. The grid displays with columns and empty data source.
Best regards,
Peter Stoev
Smart UI Team
https://www.htmlelements.com/