jQWidgets Forums

jQuery UI Widgets Forums Grid onclick inside grid cell

This topic contains 1 reply, has 2 voices, and was last updated by  Yavor Dashev 3 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • onclick inside grid cell #120689

    nicoletacornea
    Participant

    is there a way to force the grid cell to render html if it contains an onclick ?

    ex:
    this field renders the image
    dataRow[“id”] = value.id+ ‘ ‘ ;

    this shows encoded html
    dataRow[“id”] = value.id+ ‘ ‘ ;

    shows:
    1234567 <img src="http://localhost:61587//Images/image.png" style="width:28px; height:36px; border:hidden;" onclick="/>

    onclick inside grid cell #120692

    Yavor Dashev
    Participant

    Hi nicoletacornea,

    The context and information that you have shared is a bit scarce, but based on it I have created a quick code snippet that showcases the functionality that you need.

    We will use the jqxGrid`s ‘cellclick’ event for this code example.
    In your JS:

                $("#grid").on("cellclick", function (event) 
                    {
                        // event arguments.
                        let args = event.args,
                         rowBoundIndex = args.rowindex,
                         girdRow = document.getElementById('row'+rowBoundIndex+'grid'),
                         rowCell = girdRow.querySelector("div[columnindex='1'");
    
                        rowCell.firstElementChild.innerHTML = "<p> Clicked cell</p>";
                    });                       
    

    Let me know if that works for you!

    Please, do not hesitate to contact us if you have any additional questions.

    Best Regards,
    Yavor Dashev
    jQWidgets team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.