Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #103337
    Rafa Esparza
    Participant

    Hi,
    I would like to know if it is posible set listeners in column definition of the grids. What i’m trying to do is put checkbox in a grid column and when the checkbox is checked, do something.

    thanks in advance!

     columns =[
    { label: 'Asignado', dataField: 'asignado', template: 'checkBox', editor: 'checkBox', allowEdit: true, <strong>cellListener: () => doSomething()</strong> }
    ]
    
    #103339

    Hi Rafa,

    You can add an event listener to Grid cells like that:

    const grid = document.querySelector('smart-grid');
    grid.addEventListener('cellClick', function (event) {
        const detail = event.detail,
            cell = detail.cell,
            originalEvent = detail.originalEvent,
            id = detail.id,
            dataField = detail.dataField,
            isRightClick = detail.isRightClick,
            pageX = detail.pageX,
            pageY = detail.pageY;
    
    	// event handling code goes here.
    })

    The data field is the column’s data field and you will be able to identify the column by using that event.

    Best regards,
    Jack

    Smart UI Team
    https://www.htmlelements.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.