Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed Jul 27, 2024
2 parents 913ab41 + 150330a commit d24c460
Show file tree
Hide file tree
Showing 15 changed files with 118 additions and 28 deletions.
2 changes: 1 addition & 1 deletion assets/js/template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
window._config = {
isDebug: location.hash.slice(1) === 'is-debug' ||
['localhost', '127.0.0.1', 'dev.bootstrap-table.com'].indexOf(location.hostname) > -1,
cdnUrl: 'https://cdn.jsdelivr.net/npm/[email protected].1/dist/',
cdnUrl: 'https://cdn.jsdelivr.net/npm/[email protected].2/dist/',
localUrl: '../bootstrap-table/src/',
testUrl: '/src/'
}
Expand Down
4 changes: 2 additions & 2 deletions crud/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].1/dist/bootstrap-table.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].2/dist/bootstrap-table.min.css">
<style>
.mr10 { margin-right: 10px; }
.alert {
Expand All @@ -17,7 +17,7 @@
<script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].1/dist/bootstrap-table.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].2/dist/bootstrap-table.min.js"></script>
</head>
<body>
<div class="container">
Expand Down
27 changes: 24 additions & 3 deletions extensions/export.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,30 @@
data-toolbar="#toolbar"
data-show-toggle="true"
data-show-columns="true"
data-show-footer="true"
data-url="https://examples.wenzhixin.net.cn/examples/bootstrap_table/data">
</table>

<script>
var $table = $('#table')

function idFormatter() {
return 'Total'
}

function nameFormatter(data) {
return data.length
}

function priceFormatter(data) {
var field = this.field
return '$' + data.map(function (row) {
return +row[field].substring(1)
}).reduce(function (sum, i) {
return sum + i
}, 0)
}

function mounted() {
$('#toolbar').find('select').change(function () {
$table.bootstrapTable('destroy').bootstrapTable({
Expand All @@ -55,15 +73,18 @@
},
{
field: 'id',
title: 'ID'
title: 'ID',
footerFormatter: idFormatter
},
{
field: 'name',
title: 'Item Name'
title: 'Item Name',
footerFormatter: nameFormatter
},
{
field: 'price',
title: 'Item Price'
title: 'Item Price',
footerFormatter: priceFormatter
}
]
})
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
<li><a href="#options/basic-columns.html">Basic Columns</a></li>
<li><a href="#options/buttons.html">Buttons Custom</a></li>
<li><a href="#options/buttons-align.html">Buttons Align</a></li>
<li><a href="#options/buttons-attribute-title.html">Buttons Attribute Title</a></li>
<li data-show="bootstrap3,bootstrap4,"><a href="#options/buttons-class.html">Buttons Class</a></li>
<li><a href="#options/buttons-order.html">Buttons Order</a></li>
<li data-show="bootstrap3,bootstrap4,"><a href="#options/buttons-prefix.html">Buttons Prefix</a></li>
Expand Down
13 changes: 9 additions & 4 deletions methods/insert-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
<button id="button" class="btn btn-secondary">insertRow</button>
</div>
<table id="table"
data-toggle="table"
data-toolbar="#toolbar"
data-height="428"
data-url="json/data1.json">
data-toggle="table"
data-toolbar="#toolbar"
data-height="428"
data-url="json/data1.json">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
Expand All @@ -40,5 +41,9 @@
}
})
})

$table.on('check.bs.table', (event, row) => {
console.log(JSON.stringify(row))
})
}
</script>
36 changes: 28 additions & 8 deletions methods/update-cell.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,27 @@
</script>

<div id="toolbar">
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" checked id="reinit">
<label class="form-check-label" for="flexCheckDefault">
reinit
</label>
</div>
<button id="button" class="btn btn-secondary">updateCell</button>
</div>
<table
id="table"
data-toggle="table"
data-toolbar="#toolbar"
data-height="428"
data-search="true"
data-url="json/data1.json">
<thead>
<tr>
<th data-checkbox="true" data-field="state"></th>
<th data-field="id">ID</th>
<th data-field="name" data-width="300">Item Name</th>
<th data-field="price">Item Price</th>
<th data-field="id" data-sortable="true">ID</th>
<th data-field="name" data-sortable="true" data-width="300">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
</table>
Expand All @@ -32,15 +39,28 @@

function mounted() {
$button.click(function () {
let i = 0
setInterval(() => {
const checked = $('#reinit').prop('checked')

if (!checked) {
let i = 0
const timeout = setInterval(() => {
$table.bootstrapTable('updateCell', {
index: 1,
field: 'name',
value: `Updated Name ${i++}`,
reinit: false
})
if (i > 10) {
clearInterval(timeout)
}
}, 100)
} else {
$table.bootstrapTable('updateCell', {
index: 1,
field: 'name',
value: `Updated Name ${i++}`,
reinit: false
value: 'Updated Name'
})
}, 100)
}
})
}
</script>
7 changes: 4 additions & 3 deletions methods/update-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
data-toggle="table"
data-toolbar="#toolbar"
data-height="428"
data-search="true"
data-url="json/data1.json">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
<th data-field="id" data-sortable="true">ID</th>
<th data-field="name" data-sortable="true">Item Name</th>
<th data-field="price" data-sortable="true">Item Price</th>
</tr>
</thead>
</table>
Expand Down
35 changes: 35 additions & 0 deletions options/buttons-attribute-title.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<script>
init({
title: 'Buttons Attribute Title',
desc: 'Customize the title attribute of the toolbar buttons, which is mainly used to customize the toolbar style.',
links: [
'https://unpkg.com/[email protected]/src/hint-css.css',
'bootstrap-table.min.css'
],
scripts: [
'https://unpkg.com/[email protected]/src/hint-css.js',
'bootstrap-table.min.js'
]
})
</script>

<table
id="table"
data-toggle="table"
data-height="460"
data-search="true"
data-show-pagination-switch="true"
data-show-refresh="true"
data-show-toggle="true"
data-show-columns="true"
data-show-fullscreen="true"
data-buttons-attribute-title="data-hint"
data-url="json/data1.json">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
9 changes: 8 additions & 1 deletion options/search-highlight.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
<tr>
<th data-field="id">ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
<th data-field="price" data-formatter="priceFormatter">Item Price</th>
</tr>
</thead>
</table>

<script>
function priceFormatter (value, row) {
return `<span>${value}</span>
<span style="margin-left: 5px">(${row.name})</span>`
}
</script>
2 changes: 1 addition & 1 deletion options/table-locale.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
links: ['bootstrap-table.min.css'],
scripts: [
'bootstrap-table.min.js',
'https://cdn.jsdelivr.net/npm/[email protected].1/dist/bootstrap-table-locale-all.min.js'
'https://cdn.jsdelivr.net/npm/[email protected].2/dist/bootstrap-table-locale-all.min.js'
]
})
</script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-table-examples",
"version": "1.23.1",
"version": "1.23.2",
"description": "bootstrap-table-examples",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion vue-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"bootstrap-icons": "^1.11.3",
"bootstrap-table": "^1.23.1",
"bootstrap-table": "^1.23.2",
"jquery": "^3.7.1",
"tableexport.jquery.plugin": "^1.30.0",
"vue": "^3.4.27"
Expand Down
2 changes: 1 addition & 1 deletion webpack-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"bootstrap": "^4.5.0",
"bootstrap-table": "^1.23.1",
"bootstrap-table": "^1.23.2",
"jquery": "^3.5.1",
"popper.js": "^1.16.1"
},
Expand Down
2 changes: 1 addition & 1 deletion welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
scripts: [
'https://cdn.jsdelivr.net/npm/[email protected]/tableExport.min.js',
'bootstrap-table.min.js',
'https://cdn.jsdelivr.net/npm/[email protected].1/dist/bootstrap-table-locale-all.min.js',
'https://cdn.jsdelivr.net/npm/[email protected].2/dist/bootstrap-table-locale-all.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
Expand Down
2 changes: 1 addition & 1 deletion welcomes/vue-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
scripts: [
'https://unpkg.com/vue@3/dist/vue.global.js',
'bootstrap-table.min.js',
'https://cdn.jsdelivr.net/npm/[email protected].1/dist/bootstrap-table-vue.umd.js'
'https://cdn.jsdelivr.net/npm/[email protected].2/dist/bootstrap-table-vue.umd.js'
]
})
</script>
Expand Down

0 comments on commit d24c460

Please sign in to comment.