Our blazing fast Grid component built with pure JavaScript


Post by dmnewnham »

Hi,

Very new to JavaScript so this is probably a dumb question. I want to add a listener to row / cell - which I have done succesfully but I wish to capture the ID of the row in which the cell is being clicked. I'm simply using

listeners : {
cellclick: myCellClickfn()
},

And I wish to process something using the ID of the row that is being clicked. How do I reference the record/id in JavaScript from the Grid?

eg..should it be cellclick: my CellClickfn(record.id) or do I reference it in the "myCellClickfn" itself...and if so, what is the syntax?

Thanks


Post by mats »

Sure, you can find info about the parameters passed to the event listener in the docs: https://bryntum.com/docs/scheduler/#Grid/view/mixin/GridElementEvents#event-cellClick

First of all you should pass your method to the cellclick listener like (don't call it like you did):

listeners : {
	cellclick: myCellClickfn
}
function myCellClickfn(event) {
	console.log(event.record.id)
}

Post by dmnewnham »

Thanks so much! Absolutely perfect. I'll be licensing this library for sure!


Post Reply