Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter nymphbyte

    (@nymphbyte)

    Thank you for your reply! In the meantime i’ve came up with the solution for both the datatable and html view:

    I listed the code from my own example:

    datatable:

    <p>[cfdb-datatable id="contractors" form="Contact form 1" show="Businessname,your-name,tel-176,your-email,Website,logo,City,State,ZIP,your-message" role="Subscriber" permissionmsg="true" headers="Businessname=Business type,your-name=Name,tel-176=Phone,your-email=Email,logo=Logo,your-message=Specialty" ]</p>
    
    <style>
    #contractors td > div { max-height: inherit;  }
    </style>
    
    //script to change a tag to img
    
    $( '#contractors td[title=logo]' ).each(function() {
        var href = $(this).find("a").attr('href');
        var parent=$(this).find("a").parent();
        parent.html("<img src='"+href+"'>")
    
      });

    html: – enabled search field

    [cfdb-html form="Contact form 1" show="logo,your-name,tel-176,your-email,City,Businessname,Website,State,ZIP,your-message" role="Subscriber" permissionmsg="true" filelinks="url" wpautop="false" stripbr="false"]{{BEFORE}}
    <input type="text" id="search" placeholder="Type to search">
    <table id="table">  {{/BEFORE}}
    <tr>
        <td>${Businessname}</td>
        <td><img src="${logo}"></td>
        <td>${your-name}</td>
        <td>${tel-176}</td>
        <td>${your-email}</td>
        <td>${Website}</td>
        <td>${City}</td>
        <td>${State}</td>
        <td>${ZIP}</td>
        <td>${your-message}</td>
       </tr>
    
    {{AFTER}}</table>
    <script type="text/javascript">// <![CDATA[
    var $=jQuery;
    var $rows = $('#table tr');
    $('#search').keyup(function() {
        var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase();
    
        $rows.show().filter(function() {
            var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
            return !~text.indexOf(val);
        }).hide();
    });
    
    // ]]></script>
    {{/AFTER}}[/cfdb-html]
Viewing 1 replies (of 1 total)