Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed Sep 20, 2024
2 parents d24c460 + a9db62b commit 30f9537
Show file tree
Hide file tree
Showing 11 changed files with 132 additions and 10 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].2/dist/',
cdnUrl: 'https://cdn.jsdelivr.net/npm/[email protected].3/dist/',
localUrl: '../bootstrap-table/src/',
testUrl: '/src/'
}
Expand Down
39 changes: 38 additions & 1 deletion column-options/formatter.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
title: 'Column Formatter',
desc: 'Use `formatter` column option to format the display of bootstrap table column.',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
scripts: [
'bootstrap-table.min.js',
'https://unpkg.com/echarts@5/dist/echarts.simple.min.js'
]
})
</script>

Expand All @@ -17,6 +20,7 @@
<th data-field="id" data-formatter="ID: %s">ID</th>
<th data-field="name" data-formatter="nameFormatter">Item Name</th>
<th data-field="price" data-formatter="priceFormatter">Item Price</th>
<th data-field="price_chart" data-formatter="priceChartFormatter">Price Chart</th>
</tr>
</thead>
</table>
Expand All @@ -35,4 +39,37 @@
value.substring(1) +
'</div>'
}

function randomData () {
return new Array(7).fill(0).map(function () {
return Math.round(Math.random() * 20)
})
}

function priceChartFormatter() {
const chartDom = document.createElement('div')

// Size needs to be set because DOM is not mounted immediate and size cannot be obtained.
chartDom.style.width = '300px'
chartDom.style.height = '200px'

const myChart = echarts.init(chartDom)

myChart.setOption({
xAxis: {
type: 'category',
data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
},
yAxis: {
type: 'value'
},
series: [
{
data: randomData(),
type: 'line'
}
]
})
return chartDom
}
</script>
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].2/dist/bootstrap-table.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected].3/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].2/dist/bootstrap-table.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected].3/dist/bootstrap-table.min.js"></script>
</head>
<body>
<div class="container">
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
<li><a href="#methods/show-hide-loading.html">Show/Hide Loading</a></li>
<li><a href="#methods/show-hide-row.html">Show/Hide Row</a></li>
<li><a href="#methods/sort-by.html">Sort By</a></li>
<li><a href="#methods/sort-reset.html">Sort reset</a></li>
<li><a href="#methods/toggle-detail-view.html">Toggle Detail View</a></li>
<li><a href="#methods/toggle-fullscreen.html">Toggle Fullscreen</a></li>
<li><a href="#methods/toggle-pagination.html">Toggle Pagination</a></li>
Expand Down
84 changes: 84 additions & 0 deletions methods/sort-reset.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<script>
init({
title: 'Sort reset',
desc: 'Resets sort state of the table regardless of whether caused by the user or programmatically.',
links: ['bootstrap-table.min.css'],
scripts: ['bootstrap-table.min.js']
})
</script>

<style>
#sort {
display: inline-block;
width: auto;
}
</style>

<div class="toolbar">
Sort by:
<select id="sort" class="form-control">
<option value="name_asc">Name ascending</option>
<option value="name_desc">Name descending</option>
<option value="stargazers_asc">Stargazers low - high</option>
<option value="stargazers_desc">Stargazers high - low</option>
<option value="forks_asc">Forks low - high</option>
<option value="forks_desc">Forks high - low</option>
</select>

<button id="sortReset" class="btn btn-secondary">Sort reset</button>
</div>

<table
id="table"
data-toggle="table"
data-sort-name="github.name"
data-toolbar=".toolbar"
data-url="json/data3.json">
<thead>
<tr>
<th data-field="github.name">Name</th>
<th data-field="github.count.stargazers">Stargazers</th>
<th data-field="github.count.forks">Forks</th>
<th data-field="github.description">Description</th>
</tr>
</thead>
</table>

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

function mounted() {
$sort.change(function() {
var field = ''
var sortOrder = ''

if (this.value === 'name_asc') {
field = 'github.name'
sortOrder = 'asc'
} else if (this.value === 'name_desc') {
field = 'github.name'
sortOrder = 'desc'
} else if (this.value === 'stargazers_asc') {
field = 'github.count.stargazers'
sortOrder = 'asc'
} else if (this.value === 'stargazers_desc') {
field = 'github.count.stargazers'
sortOrder = 'desc'
} else if (this.value === 'forks_asc') {
field = 'github.count.forks'
sortOrder = 'asc'
} else if (this.value === 'forks_desc') {
field = 'github.count.forks'
sortOrder = 'desc'
}

$table.bootstrapTable('sortBy', {
field: field,
sortOrder: sortOrder
})
})

$('#sortReset').on('click', () => $table.bootstrapTable('sortReset'))
}
</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].2/dist/bootstrap-table-locale-all.min.js'
'https://cdn.jsdelivr.net/npm/[email protected].3/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.2",
"version": "1.23.3",
"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.2",
"bootstrap-table": "^1.23.3",
"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.2",
"bootstrap-table": "^1.23.3",
"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].2/dist/bootstrap-table-locale-all.min.js',
'https://cdn.jsdelivr.net/npm/[email protected].3/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].2/dist/bootstrap-table-vue.umd.js'
'https://cdn.jsdelivr.net/npm/[email protected].3/dist/bootstrap-table-vue.umd.js'
]
})
</script>
Expand Down

0 comments on commit 30f9537

Please sign in to comment.