Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3744

Howto custom render for Editor Edit window.

$
0
0

hi,

I have a field in my data that is an URL. I would like to display this as an icon with the URL as an anchor around the icon. I was able to get this working fine for the grid display, using this :

{label: "",name: "recruiters.bookingLink", type: "readonly",
    render: function (data) {
        if (isValidHttpUrl(data)) {
            const blink = "<a href='" + data + "' target='_blank' ><img src='https://www.dlf.pt/dfpng/middlepng/518-5187293_logo-google-meet-png-hd-transparent-png.png' width='50px' class='ml-2' data-toggle='popover' data-title='Content' data-html='true' data-content='Some text'</img></a>";
            return blink;
        } else {
            return ''
        }
    }
},

Note: isValidHttpUrl is a function that checks if the URL is valid.

I don't care about saving this field ever, as it is always a read-only field.

However when using the Form Edit, the field is displayed as a basic text input field.
I am using a custom template for my Edit form, but I tried using the internal Edit form too.

I know I saw this somewhere before, but now cannot find how to apply a render to the edit form

Can anyone help?


Viewing all articles
Browse latest Browse all 3744

Trending Articles