JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Data Grid › initialize grid with empty dataSource › Reply To: initialize grid with empty dataSource
window.onload = function () {
initGrid();
};
function initGrid() {
Smart(“#grid”, class {
get properties() {
return {
selection: {
enabled: false,
allowRowSelection: false,
checkBoxes: {
enabled: true
}
},
onCommand: function (args) {
if (args.name === “commandColumnRowMenuCommand”) {
const row = args.details;
const menu = document.getElementById(“menuGrid”);
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;
}
},
editing: {
enabled: true,
mode: “row”,
action: “none”,
dialog: {
enabled: true
},
commandColumn: {
visible: true,
position: “near”,
dataSource: {
commandColumnMenu: {
visible: true
},
commandColumnRowMenu: {
visible: true
}
}
}
},
dataSource: [],
columns: [
{
label: “IDCliente”,
dataField: “IDCliente”,
dataType: “number”
},
{
label: “IDAzienda”,
dataField: “IDAzienda”,
dataType: “number”
},
{
label: “aziNome”,
dataField: “aziNome”,
dataType: “string”
}
]
};
}
}
);
}
the problem seems to be commandColumn property inside editing,If i remove it the grid work fine.
In your codepen commandColumn has no problem, is it because u call an instance of smart.dataAdapter?