Search code examples
bootstrap-table

bootstrap-table password column hashed out


Is there a way with bootstrap-table to have one of the columns show passwords as none readable? I.E. #### not 1234 My setup uses the method below, any help would be great. This is not for security issues, it's just aesthetics. Many thanks

var optionsuser = {
     filterControl: true,
     showRefresh: true,
     search: true,
     pagination: true,
     filter: true,
     striped: true,
     url: "php/api.php",
     queryParams: queryParamsuser,
    columns: [{
        field: "id",
        title: "Id"
    }, 
    {
        field: "username",
        title: "Username",
        filterControl: 'select',
        sortable: true,
        filterStrictSearch: false
    }, 
    {
        field: "password",
        title: "Password"
    }
    ],
};
   var $table = $('#table').bootstrapTable(optionsuser),
     $modal = $('#modal').modal({show: false}),
     $alert = $('.alert').hide();
     $table.bootstrapTable('hideColumn', 'id');

Solution

  • Try this one.

     <th data-field="Password"  data-sortable="true" data-formatter="nameFormatter">Password</th>
    
    function nameFormatter(value) {
        var str='';
        for(i=0;i<value.length;i++)
        {
                str=str+'*';
        }
        return str;
    }
    

    You may also check http://bootstrap-table.wenzhixin.net.cn/documentation/ out.