Rendering columns with custom tags

Rendering columns with custom tags

NatalyCevaNatalyCeva Posts: 6Questions: 2Answers: 0

Hi, I'm using inertiajs to create links via the <Link> tag, but when they get rendered, they appear as <link> therefore does not work. Is there any way to render such tags?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    HTML is not case sensitive. We just use .innerHTML for the cell content by default, so I suspect the behaviour you are seeing comes form the browser?

    I've not used inertiajs - does it depend upon case?

    Allan

  • NatalyCevaNatalyCeva Posts: 6Questions: 2Answers: 0

    To be precise, Vuejs is case sensitive.

    Since inertiajs imports are used in Vuejs context, then, yes: <Link> differs from <link>. It renders fine when using in Vuejs context, but not when rendering via DataTables. Please also see this.

  • NatalyCevaNatalyCeva Posts: 6Questions: 2Answers: 0
    edited April 2023

    Here's the problematic code:

     {
            data: 'id',
            title: 'Actions',
            order: 'false',
            sortable: 'false',
            className: 'w-56',
            render: function ( data, type, row ) {
                return  "<Link href="+route('invoice.print', data)+" method=\"get\" as=\"button\" type=\"button\"></Link>";
            }
        },
    

    So the <Link> tag is rendered as <link>, therefore it is not transpiled correctly.

    Probably, it is being rendered as a <link> HTML5 tag, which is a valid HTML5 tag and therefore an interference?

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Thanks for the clarification. Unfortunately, at this time, it is not possible to use components in the results returned from render. That is something I would like to address in future.

    Sorry!
    Allan

Sign In or Register to comment.