Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions for-tests/extensions/export/export-customTypes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script>
init({
title: 'Export Custom Types',
desc: 'Test exportTypes with multiple supported types.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Comment thread
wenzhixin marked this conversation as resolved.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
data: [
Comment thread
wenzhixin marked this conversation as resolved.
{ id: 1, name: 'Item 1', price: '$1' },
{ id: 2, name: 'Item 2', price: '$2' },
{ id: 3, name: 'Item 3', price: '$3' }
]
})
}
</script>
41 changes: 41 additions & 0 deletions for-tests/extensions/export/export-dataType-all.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script>
init({
title: 'Export Data Type All',
desc: 'Test exportDataType=all with pagination.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Comment thread
wenzhixin marked this conversation as resolved.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<script>
function mounted () {
const data = []

for (let i = 1; i <= 50; i++) {
data.push({ id: i, name: `Item ${i}`, price: `$${i}` })
}
$('#table').bootstrapTable({
showExport: true,
exportDataType: 'all',
pagination: true,
pageSize: 10,
data
})
}
</script>
39 changes: 39 additions & 0 deletions for-tests/extensions/export/export-dataType-selected.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<script>
init({
title: 'Export Data Type Selected',
desc: 'Test exportDataType=selected with checkbox selection.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export extension depends on the tableExport plugin (and its supporting libs like FileSaver). With only bootstrap-table-export loaded, clicking the export button / calling exportTable is likely to fail because tableExport isn’t present. Consider adding the same tableExport script(s) used in extensions/export.html before bootstrap-table.min.js / bootstrap-table-export.

Suggested change
scripts: [
scripts: [
'FileSaver.min.js',
'tableExport.min.js',

Copilot uses AI. Check for mistakes.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
exportDataType: 'selected',
data: [
{ id: 1, name: 'Item 1', price: '$1', state: false },
{ id: 2, name: 'Item 2', price: '$2', state: false },
{ id: 3, name: 'Item 3', price: '$3', state: false }
]
})
}
</script>
44 changes: 44 additions & 0 deletions for-tests/extensions/export/export-events.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script>
init({
title: 'Export Events',
desc: 'Test export-started and export-saved events.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export extension depends on the tableExport plugin (and its supporting libs like FileSaver). With only bootstrap-table-export loaded, clicking the export button / calling exportTable is likely to fail because tableExport isn’t present. Consider adding the same tableExport script(s) used in extensions/export.html before bootstrap-table.min.js / bootstrap-table-export.

Suggested change
scripts: [
scripts: [
'https://unpkg.com/file-saver/dist/FileSaver.min.js',
'https://unpkg.com/tableexport.jquery.plugin/tableExport.min.js',

Copilot uses AI. Check for mistakes.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
data: [
{ id: 1, name: 'Item 1', price: '$1' },
{ id: 2, name: 'Item 2', price: '$2' }
]
})

$('#table').on('export-started.bs.table', function () {
window._exportStarted = true
})
$('#table').on('export-saved.bs.table', function (e, data) {
window._exportSaved = true
window._exportedData = data
})
}
</script>
41 changes: 41 additions & 0 deletions for-tests/extensions/export/export-fileName-function.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script>
init({
title: 'Export fileName Function',
desc: 'Test exportOptions.fileName as function.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export extension depends on the tableExport plugin (and its supporting libs like FileSaver). With only bootstrap-table-export loaded, clicking the export button / calling exportTable is likely to fail because tableExport isn’t present. Consider adding the same tableExport script(s) used in extensions/export.html before bootstrap-table.min.js / bootstrap-table-export.

Suggested change
scripts: [
scripts: [
'FileSaver.min.js',
'tableExport.min.js',

Copilot uses AI. Check for mistakes.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
exportOptions: {
fileName () {
return 'custom-export-name'
}
},
data: [
{ id: 1, name: 'Item 1', price: '$1' },
{ id: 2, name: 'Item 2', price: '$2' }
]
})
}
</script>
47 changes: 47 additions & 0 deletions for-tests/extensions/export/export-footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script>
init({
title: 'Export Footer',
desc: 'Test exportFooter=true to include table footer in export.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The export extension depends on the tableExport plugin (and its supporting libs like FileSaver). With only bootstrap-table-export loaded, clicking the export button / calling exportTable is likely to fail because tableExport isn’t present. Consider adding the same tableExport script(s) used in extensions/export.html before bootstrap-table.min.js / bootstrap-table-export.

Suggested change
scripts: [
scripts: [
'https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.5/FileSaver.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.core.min.js',
'https://unpkg.com/tableexport.jquery.plugin/tableExport.min.js',

Copilot uses AI. Check for mistakes.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Total</td>
<td></td>
<td>$6</td>
</tr>
</tfoot>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
Comment thread
wenzhixin marked this conversation as resolved.
showFooter: true,
exportFooter: true,
height: 400,
data: [
{ id: 1, name: 'Item 1', price: '$1' },
{ id: 2, name: 'Item 2', price: '$2' },
{ id: 3, name: 'Item 3', price: '$3' }
]
})
}
</script>
38 changes: 38 additions & 0 deletions for-tests/extensions/export/export-forceExport.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script>
init({
title: 'Export forceExport',
desc: 'Test forceExport column option to export hidden columns.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Comment thread
wenzhixin marked this conversation as resolved.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
<th data-field="secret" data-visible="false" data-force-export="true">Secret</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
data: [
{ id: 1, name: 'Item 1', price: '$1', secret: 's1' },
{ id: 2, name: 'Item 2', price: '$2', secret: 's2' },
{ id: 3, name: 'Item 3', price: '$3', secret: 's3' }
]
})
}
</script>
38 changes: 38 additions & 0 deletions for-tests/extensions/export/export-forceHide.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script>
init({
title: 'Export forceHide',
desc: 'Test forceHide column option to hide columns from export.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Comment thread
wenzhixin marked this conversation as resolved.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
<th data-field="icon" data-force-hide="true">Icon</th>
</tr>
</thead>
</table>

<script>
function mounted () {
$('#table').bootstrapTable({
showExport: true,
data: [
{ id: 1, name: 'Item 1', price: '$1', icon: '⭐' },
{ id: 2, name: 'Item 2', price: '$2', icon: '🔥' },
{ id: 3, name: 'Item 3', price: '$3', icon: '✅' }
]
})
}
</script>
41 changes: 41 additions & 0 deletions for-tests/extensions/export/export-method.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<script>
init({
title: 'Export Method',
desc: 'Test exportTable() method for programmatic export.',
links: [
'bootstrap-table.min.css'
],
scripts: [
Comment thread
wenzhixin marked this conversation as resolved.
'https://cdn.jsdelivr.net/npm/tableexport.jquery.plugin@1.29.0/tableExport.min.js',
'bootstrap-table.min.js',
'extensions/export/bootstrap-table-export.min.js'
]
})
</script>

<table id="table">
<thead>
<tr>
<th data-field="id">ID</th>
<th data-field="name">Name</th>
<th data-field="price">Price</th>
</tr>
</thead>
</table>

<button id="btn-export" class="btn btn-secondary">Export CSV</button>

<script>
function mounted () {
$('#table').bootstrapTable({
data: [
{ id: 1, name: 'Item 1', price: '$1' },
{ id: 2, name: 'Item 2', price: '$2' }
]
})

$('#btn-export').click(function () {
$('#table').bootstrapTable('exportTable', { type: 'csv' })
})
}
</script>
Loading
Loading