Quantcast
Viewing latest article 1
Browse Latest Browse All 2

Answer by wenyi for how I can add extra my attribute into bootstrapTable

I think formatter option is useful in your case:

var x = [    {"id": 0,"name": "test0","price": "0"        ,"pricesymbole":"$ "    },    {"id": 1,"name": "test1","price": "1"      ,"pricesymbole":"¥"    },    {"id": 2,"name": "test2","price": "2"      ,"pricesymbole":"$ "    },    {"id": 3,"name": "test3","price": "3"      ,"pricesymbole":"¥"    }];$(function () {    $('#table').bootstrapTable({        data: x    });});function priceFormatter(value, row) {    return row.pricesymbole + value;}
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"><!-- Latest compiled and minified CSS --><link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.css"><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script><script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script><script src="http://cdnjs.cloudflare.com/ajax/libs/bootstrap-table/1.10.1/bootstrap-table.min.js"></script><table id="table"><thead><tr id="tr_{{id}}"><th data-field="id">Item ID</th><th data-field="name">Item Name</th><th data-field="price" data-formatter="priceFormatter">Item Price</th></tr></thead></table>

Viewing latest article 1
Browse Latest Browse All 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>